I see what you mean but I think you are mixing definitions here.
The fields are the structure that record metadata and the actual data value. These data structures are composed of key-value pairs. For example, if I am recording the temperature and pressure of a room, “temperature” and “pressure” are the field keys, while 23ºC and 101,325 Pa are the respective field values. In influx, at least one field is required, but these are not indexed, which means that querying by field will yield all points within the time range, which is not performant relative to tags
On the other hand, tags are the strings that store metadata, which gives you information about the source of the data or any other that allows to distinguish between values (i.e.: the device that produced the data). As opposed to fields, tag values are indexed, so queries on tag values are performant. Following the example from before, I could add a tag key called ‘rooms’ where tag values could be the different rooms of a house: kitchen, bedroom, living room, etc. By doing so, I could query the temperature and pressure from a selected room:
This would yield all the values of temperature and pressure from the kitchen.
Basically, fields are the actual values of your time-series, while the tags are associated metadata that allow you to make distinctions and, therefore, query better from your data.
Even though I might be using influx in an none intended way, is it possible to produce the result I wish to have with the help of grouping and pivoting? (or other functions)
So basically what you are trying to do is locate one single record and extract it as a dict? If what you want to do so you can use the getRecord function.
Is that what you were trying to do? Or are you trying to get all the possible key-value combinations for the records within a time period?
I’m trying to get the data out in dicts in the same order I inserted it like this:
time: 1, tags: [“a”: 1, “b”: 2], fields: [“c”: 3, “d”: 4]
time: 2, tags: [“a”: 2, “b”: 1], fields: [“c”: 4, “d”: 5]
time: 3, tags: [“a”: 4, “b”: 3], fields: [“c”: 1, “d”: 2]
Sorry if I was unclear, I had it like this with an earlier version (1.8 I think) of influxdb and I have a massive project that needs the data like that.
Edit: I forgot to say that the timestamps are not always unique.
I have gotten the data in the way I wan’t to… kind of.
I ask for 8 hours of data and get the last data repeated thousands of times with timestamps a few microseconds apart.
Using the Data Explorer (included in influxdb) gives me the result I’m after with the same (copy pasted) query, but when I get the data in python it’s not the same.