Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create RethinkDB database from command line

Tags:

rethinkdb

I need to programatically create a RethinkDB database from the command line. However...I have no clue how to do this.

I know that I can do this from the web UI or from a client driver, but isn't there a command that does this?

like image 838
linkyndy Avatar asked Apr 30 '15 21:04

linkyndy


2 Answers

As mlucy mentioned, you can create databases and tables using the query language. If you'd like to run RethinkDB queries directly from the command line, you may want to try one of these libraries:

  • reql-cli: https://github.com/Workshape/reql-cli
  • recli: https://github.com/stiang/recli
like image 61
mglukhovsky Avatar answered Sep 17 '22 00:09

mglukhovsky


If you have the Python driver you can do the following:

echo -e  'import rethinkdb as r; \nr.connect("localhost", 28015).repl() \nr.db_create("NAME_OF_YOUR_DATABASE").run()'  | python

To install the Python driver, you can just use pip:

pip install rethinkdb

This might not be the best way of doing this, but it might be the easiest way of achieving this if you want to create a database in one line from the command line.

If you a Node.js developer, I would recommend using the two CLIS mglukhovsky mentioned.

like image 24
Jorge Silva Avatar answered Sep 19 '22 00:09

Jorge Silva