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?
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?
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.
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:
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.
As of RethinkDB 2.0 I believe you can only do this with the web UI or a client driver. Is there a reason why shelling out to Python or Ruby doesn't work here?
© 2022 - 2024 — McMap. All rights reserved.
rethinkdb createdb name
in a provisioning script. – Brooke