Skip to content

Instantly share code, notes, and snippets.

@tudorels
Forked from coffeemug/rethinkdb-import-export.md
Created January 19, 2023 08:21
Show Gist options
  • Save tudorels/410058245d223b54f3f4b93fea982a20 to your computer and use it in GitHub Desktop.
Save tudorels/410058245d223b54f3f4b93fea982a20 to your computer and use it in GitHub Desktop.
Description of import and export feature introduced in RethinkDB 1.7.

You can import data as follows:

# Import a JSON document into table `users` in database `my_db`
$ rethinkdb import -c HOST:PORT -f user_data.json --table my_db.users

# Import a CSV document
$ rethinkdb import -c HOST:PORT -f user_data.csv --format csv --table my_db.users

The export command works as follows:

# Export a table into a JSON file (placed in the directory
# rethinkdb_export_DATE_TIME by default)
$ rethinkdb export -c HOST:PORT -e my_db.users

# Export a table into a CSV file
$ rethinkdb export -c HOST:PORT -e my_db.users --format csv \
                   --fields first_name,last_name,address      # `--fields` is mandatory when exporting into CSV

This is only a small taste of what import and export commands can do. Run rethinkdb import --help and rethinkdb export --help for more information on these commands.

See more about the 1.7 release in the release announcement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment