Problem with export data from influxdb OSS 2.0

Hello
I can’t export data to a csv file in any way
I tried different methods, but in the end none of them worked.

influx -database ‘database_name’ -execute ‘SELECT * FROM table_name’ -format csv > test.csv
and other

@Vladlen_Bezymanny in v2 you’ll need to use the influx query command. It will print results in CSV format. See the docs here: influx query | InfluxDB OSS 2.0 Documentation

1 Like

Thank you
but it gives me an error

influx query ‘from(bucket:“LICZNIK”) |> range(start:-1m)’ --raw --org-id “MyORG”
Error: Unauthorized access.
See ‘influx query -h’ for help

Did you notice the paragraph just under “Examples” at the link dan-moran
provided?

"Authentication credentials

“The examples below assume your InfluxDB host, organization, and token are
provided by the active influx CLI configuration. If you do not have a CLI
configuration set up, use the appropriate flags to provide these required
credentials.”

See also influx - InfluxDB command line interface | InfluxDB OSS 2.0 Documentation
#provide-required-authentication-credentials

Antony.

A little bit late… I ran:

influx query 'from(bucket:"...") |> range(start:-1m)' --raw --org ... --token ... > backup.csv

This just writes all data into a .csv, which u can later write it to InfluxDB.