So basically i want to export a database from influxdb to csv format in command line.
I type this command in the command line:
influx -database 'RoadMonitoringDB' -execute 'select * from vehicle' -format 'csv' > test.csv
It supposed to correctly export it into csv file, but what i get now is this:
unknown arguments: * from vehicle' -format 'csv'
What went wrong here? Because when i type influx -help
, the command should be like this:
influx -database 'metrics' -execute 'select * from cpu' -format 'json' -pretty
Any answers is really helpful. Thank you in advance :)
which version are you using? I just checked it on 1.7.6 and it works fine:
[root@mon-01 ~]# influx -version
InfluxDB shell version: 1.7.6
Enter an InfluxQL query
[root@mon-01 ~]# influx -precision 'rfc3339' -database 'myMetrics' -execute 'select * from up' -format 'csv' >up.txt
BTW - the -precision 'rfc3339'
is just for getting a readable timestamp.