I am writing measurement to influxdb with InfluxDBClient
library
entry = [{
"time": int((self.end)),
"measurement": "measurement1",
"fields": {
"eventId": self.eventId,
"start": self.start,
"end": self.end,
"lifetime": self.lifetime,
},
I have noticed that the db is not respecting given order of columns, instead the time
is first and then column names in alphabetical order
>SELECT * FROM "measurement1"
time end eventId hostName lifetime start
How to enforce order given in entry?
If your using InfluxQL there is no option to sort the results other than the time field
If you are using flux in then it possible to sort the query results.
from(bucket:"db/rp")
|> range(start:-12h)
|> filter(fn: (r) =>
r._measurement == "system" and
r._field == "uptime"
)
|> sort(columns:["region", "host", "_value"])