Created
April 10, 2016 21:22
-
-
Save osullivj/9c975d2a3435e218c57dd0d895d17f28 to your computer and use it in GitHub Desktop.
SpreadServe Cloud Schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create SS cloud schema | |
import socket | |
import logging | |
import os | |
import rethinkdb as rdb | |
if __name__ == "__main__": | |
conn = rdb.connect( 'localhost', 28015) | |
# drop the old DB | |
try: | |
print( rdb.db_drop( 'sscloud')) | |
except rdb.RqlRuntimeError as ex: | |
print( "sscloud DB doesn't exist %s" % ex.message) | |
# create the new DB with instance, sheet and user tables | |
try: | |
print( rdb.db_create( 'sscloud')) | |
db = rdb.db( 'sscloud') | |
print( db.table_create( 'ssinst').run( conn)) | |
print( db.table_create( 'sheet').run( conn)) | |
print( db.table_create( 'user').run( conn)) | |
except rdb.RqlRuntimeError as err: | |
print( err.message) | |
finally: | |
print( conn.close( )) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment