Skip to content

Instantly share code, notes, and snippets.

@osullivj
Created April 10, 2016 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osullivj/9c975d2a3435e218c57dd0d895d17f28 to your computer and use it in GitHub Desktop.
Save osullivj/9c975d2a3435e218c57dd0d895d17f28 to your computer and use it in GitHub Desktop.
SpreadServe Cloud Schema
# 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