bosh-db2bt

copy mysql/postgresql tables to BigObject server


Keywords
bigobject, macrodata, database, command, line, tool, mysql, postgresql
License
Apache-2.0
Install
pip install bosh-db2bt==0.0.5

Documentation

db2bt

Copy or append database tables into BigObject server

##System requirements Python 2.7.6

###mysql Packages : PyMySQL , requests

pip install PyMySQL requests

Temporal remove postgresql part because of the psycopg2 dependence

###postgresql Packages : psycopg2 , requests

pip install psycopg2 requests

How to use

copy mysql table into bigobject server

python mysql2bt.py <host> <port> <db name> <user> <password> <table name> <bo host> <bo port>

append mysql table into bigobject server

python mysql2bt.py <host> <port> <db name> <user> <password> <table name> <bo host> <bo port> append

load mysql data into bigobject server by a sql statement

python mysql2bt.py <host> <port> <db name> <user> <password> <bigobject table name> <bo host> <bo port> load <sql statement>

For example.

The mysql server :

    host:localhost , port:3306 , database name:test , username:root , password:1234 

The BigObject server :

    host:localhost , port:9090

You can copy the table "sales" in the mysql db to the bigobject server as follows:

python mysql2bt.py localhost 3306 test root 1234 sales localhost 9090

When the "sales" table in BigObject server is exist, it will be deleted and then re-created.

If you want to append database's table to the BigObject table, add the "append" word in the last argument as follows:

python mysql2bt.py localhost 3306 test root 1234 sales localhost 9090 append

If the table has been created, you also be able to load the data by a sql statement as follows:

python mysql2bt.py localhost 3306 test root 1234 sales localhost 9090 load "select * from sales"

Note: After the table have been imported, you still be able to modify table schema by ALTER TABLE statement.