How should I export results of cratedb database from a remote server

82 Views Asked by At

In self-host red hat managed remote server I have connected to cratedb and done some queries in python script then how should I export results of database to another tool or anything else

Like for mysql we have mysqldump then what for cratedb

1

There are 1 best solutions below

0
On

There are many different options available.

If you are looking for a data export you could for instance use https://cratedb.com/docs/crate/reference/en/5.5/sql/statements/copy-to.html to export data from a table to JSON lines files, this command accepts a WHERE clause and it can restrict the output to specific columns and partitions.

If you are looking at this with the aim of getting that data across to another CrateDB cluster you could use https://cratedb.com/docs/crate/reference/en/5.5/sql/statements/create-snapshot.html

If you are looking to export the output of a query from a command line utility you can use https://cratedb.com/docs/crate/crash/en/latest/ to get the data exported in different formats.

In alternative if your Python scripts are already getting the results client side, you could for instance get the results on a DataFrame https://cratedb.com/docs/python/en/latest/#sqlalchemy and then export it or use with other libraries whatever way you see fit.

I hope this helps. Do not hesitate to ask if you have any further questions.