David
David

Reputation: 499

Can CockroachDB save the results of a query to a CSV file?

Is there a way to export the results of a running reporting query, or just to get the contents of a given table, to a CSV file (e.g. that could then be imported by Excel or similar)?

Upvotes: 1

Views: 1453

Answers (1)

David
David

Reputation: 499

You can export to CSV by running a SELECT statement from the command line with the --format=csv flag, e.g.:

cockroach sql --format=csv -e 'SELECT * FROM bank.customers;' > csvtest.csv

Upvotes: 1

Related Questions