I would like to export my InfluxDB database to a CSV file. Im currently using the following code:
$ influx -database 'Dabtabase_name' -execute 'SELECT * FROM table_name' -format csv > test.csv
The code works but timestamps are displayed as numbers as follows:
1609459200000000000
I would like to save it in a way where the timestamp is saved in RFC3339 format, like this:
2021-01-01T00:00:00
When you first connect to the CLI, specify the rfc3339 precision
$ influx -precision rfc3339
To get RFC 3339 when you export to CSV use this.
$ influx -precision 'rfc3339' -database 'Dabtabase_name' -execute 'SELECT * FROM table_name' -format csv > test.csv