Imports a SQL database into Orchestrate (or vice versa) either as a CLI or in other Python scripts.
When importing, orchestrate-sql maps SQL tables to Orchestrate collections, and rows to key-values. For example, a table named users will be copied to a collection by the same name; each row within will be converted to a JSON document and inserted into the collection under the same key as their primary key in the SQL database.
When exporting, the tool maps likewise but in the other direction: copying collection contents to rows within tables in the destination database.
Just use pip:
pip install orchestrate-sqlThen, use the CLI to copy a SQL database into Orchestrate:
orchestrate-sql import --api-key ORCHESTRATE_APP_KEY --sql-uri sql://URI_FOR_YOUR_DATABASEOr, import it into other Python scripts:
import orchestrate_sql
orchestrate_sql.import(ORCHESTRATE_APP_KEY, URI_FOR_YOUR_DATABASE)Both commands use the same option flags:
--api-key, -a: the Orchestrate API key for whatever application you want to sync with.--sql-uri, -s: the connection URI for the SQL database you want to sync with.
Import data from a SQL database into Orchestrate.
Export data from Orchestrate into a SQL database.
Both methods take the same arguments:
def import (ORCHESTRATE_API_KEY, SQL_URI):
...
def export (ORCHESTRATE_API_KEY, SQL_URI):
...Import data from a SQL database into Orchestrate.
Export data from Orchestrate into a SQL database.
git clone https://github.com/garbados/orchestrate-sql.git
cd orchestrate-sql
python setup.py test