当前位置: 首页>>代码示例>>Python>>正文


Python PersistenceManager.drop_schema方法代码示例

本文整理汇总了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()
开发者ID:chrisalleng,项目名称:xwlists,代码行数:20,代码来源:persistence_tests.py

示例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 )
开发者ID:chrisalleng,项目名称:xwlists,代码行数:33,代码来源:persistence_tests.py


注:本文中的persistence.PersistenceManager.drop_schema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。