def table_ensure(cls, rr):
        '''
        Creates the table if it doesn't exist.
        '''
        dbs = rr.db_list().run()
        if not rr.dbname in dbs:
            logging.info('creating rethinkdb database %s', repr(rr.dbname))
            rr.db_create(rr.dbname).run()
        tables = rr.table_list().run()
        if not cls.table in tables:
            logging.info(
                    'creating rethinkdb table %s in database %s',
                    repr(cls.table), repr(rr.dbname))
            cls.table_create(rr)
def table_ensure ( cls , rr ) : dbs = rr . db_list ( ) . run ( ) if not rr . dbname in dbs : logging . info ( 'creating rethinkdb database %s' , repr ( rr . dbname ) ) rr . db_create ( rr . dbname ) . run ( ) tables = rr . table_list ( ) . run ( ) if not cls . table in tables : logging . info ( 'creating rethinkdb table %s in database %s' , repr ( cls . table ) , repr ( rr . dbname ) ) cls . table_create ( rr )
Creates the table if it doesn't exist.