示例#1
0
def teardown_module():
    metadata.drop_all()
    fresh_metadata.drop_all()
    fresh_metadata.bind.dispose()
    if os.path.exists('freshtest.db'):
        os.unlink('freshtest.db')
    sqlalchemy_cleanup()
示例#2
0
def teardown_module():
    metadata.drop_all()
    fresh_metadata.drop_all()
    fresh_metadata.bind.dispose()
    if os.path.exists('freshtest.db'):
        os.unlink('freshtest.db')
    sqlalchemy_cleanup()
 def tearDown(self):
     """Clear database configuration and drop database.
     """
     try:
         session.expunge_all()
     except:
         session.clear()
     clear_mappers()
     metadata.drop_all()
     metadata.clear()
     set_db_uri(self.sa_dburi, 'sqlalchemy')
示例#4
0
def create_tables(drop_all=False):
    """Create all tables defined in the model in the database.

    Optionally drop existing tables before creating them.

    """
    get_engine()
    if drop_all:
        print "Dropping all database tables defined in model."
        metadata.drop_all()
    metadata.create_all()

    print "All database tables defined in model created."
示例#5
0
def create_tables(drop_all=False):
    """Create all tables defined in the model in the database.

    Optionally drop existing tables before creating them.

    """
    get_engine()
    if drop_all:
        print "Dropping all database tables defined in model."
        metadata.drop_all()
    metadata.create_all()

    print "All database tables defined in model created."
def drop_tables():
    metadata.drop_all()