influxdb data/table be downloaded as csv file?

In CLI following command can be used to download tables on the local system:

influx -database 'database_name' -execute 'SELECT * FROM table_name' -format csv > test.csv

The answer posted by surya rahul worked for me but with minor correction.

Original : influx -database 'database_name' -execute 'SELECT * FROM table_name' -format csv > test.csv.
This command returned me an error "error parsing query: invalid duration"

However . A simple modidfication of using double quotes " " instead of single ' ' in the query part solved this issue. Modified : influx -database 'database_name' -execute "SELECT * FROM table_name" -format csv > test.csv.

Being new, not sure how it worked but it works. Hope it may help.


Using CLI tool influx you can set csv output format for results:

influx -host your_host -port 8086 -database 'your_db' -execute 'select * from your_metric' -format 'csv'

-host and -port options can be omitted if command is run on local InfluxDB host. There is also useful -precision option to set format of timestamp.