本文整理汇总了Python中persistence.PersistenceManager.drop_schema方法的典型用法代码示例。如果您正苦于以下问题:Python PersistenceManager.drop_schema方法的具体用法?Python PersistenceManager.drop_schema怎么用?Python PersistenceManager.drop_schema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类persistence.PersistenceManager
的用法示例。
在下文中一共展示了PersistenceManager.drop_schema方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DatabaseTestCase
# 需要导入模块: from persistence import PersistenceManager [as 别名]
# 或者: from persistence.PersistenceManager import drop_schema [as 别名]
class DatabaseTestCase(unittest.TestCase):
def setUp(self):
self.persistence_manager = PersistenceManager(True)
#just keep a top level reference to these guys for ease of use
self.session = db_connector.get_session()
#and then create the database schema, reference tables
self.persistence_manager.create_schema()
self.persistence_manager.populate_reference_tables()
self.session.commit()
def tearDown(self):
# self.session.flush()
self.session.close_all()
self.persistence_manager.drop_schema()
示例2: len
# 需要导入模块: from persistence import PersistenceManager [as 别名]
# 或者: from persistence.PersistenceManager import drop_schema [as 别名]
self.assertTrue(True)
if __name__ == "__main__":
if len (sys.argv) == 1:
unittest.main()
elif sys.argv[1] == 'create':
pm = PersistenceManager(db_connector)
pm.create_schema()
#pm.populate_reference_tables()
db_connector.get_session().commit()
db_connector.get_session().close_all()
elif sys.argv[1] == 'destroy':
pm = PersistenceManager(db_connector)
pm.drop_schema()
db_connector.get_session().commit()
db_connector.get_session().close_all()
elif sys.argv[1] == 'alter':
pm = PersistenceManager(db_connector)
#update all records in the ship_pilot table
meta = XWingMetaData()
#upgrades = meta.upgrades()
#pm.create_upgrade_table()
# upgrade_objects = []
# for ut in upgrades.keys():
# uvs = upgrades[ut]
# for uv in uvs:
# upgrade = Upgrade( upgrade_type=UpgradeType.from_string( ut ), name=uv['name'], cost=uv['cost'])
# upgrade_objects.append( upgrade )