How to ordering table columns

Someone please suggest how to ask InfluxDB 2.0 to return table columns and specify column order manually. I can ask flux to keep specific columns, but it does not respect my order .

|> keep(columns: [“inventory_no”,“temp1”,“temp2”,“battery1”,“rssi”])

Ordering of columns isn’t currently possible, but it is something that we’ve had a request for before and will be considering.

The best thing to do is open an issue on GitHub.

Thanks

Created Github column order function request #15957

1 Like

Hi,

For me it is not working completely with the query as below

|> map(fn: (r) => ({ _time: r._time, “1”: r.first, “2”: r.second, “3”: r.third, “4”: r.fourth}))
|> rename(columns: { “1”: “First”, “2”: “Second”, “3”: “Third”, “4”: “Fourth” })

till 3 it has worked, but for 4 it is showing as 4 not found. In my influx table r.fourth is r.tag and it has some 4 columns like column1, column2 etc. I am trying to put as “4”: r.column1, but not working.
How to solve this issue

Regards
Sudheer

Hi,

It is working fine for me as below:

|> map(fn: (r) => ({ “1”: r._time1, “2”: r._time2,“3”: r.first, “4”: r.second, “5”: r.third, “6”: r._fourth}))
|> rename(columns: { “1”: “time1”,“2”: “time2”,“3”: “first”, “4”: “second”, “5”: “third”,“6”: “fourth”})