本文整理汇总了Python中apex.models.DBSession.configure方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.configure方法的具体用法?Python DBSession.configure怎么用?Python DBSession.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apex.models.DBSession
的用法示例。
在下文中一共展示了DBSession.configure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from apex.models import DBSession [as 别名]
# 或者: from apex.models.DBSession import configure [as 别名]
def setUpClass(cls):
""" must add default route 'home' and include apex
we also must create a default user/pass/group to test
"""
cls.engine = engine_from_config(settings, prefix='sqlalchemy.')
DBSession.configure(bind=cls.engine)
Base.metadata.create_all(cls.engine)
示例2: setUp
# 需要导入模块: from apex.models import DBSession [as 别名]
# 或者: from apex.models.DBSession import configure [as 别名]
def setUp(self):
self.config = testing.setUp()
self.config.add_route('home', '/')
self.config.add_settings(settings)
self.config.include('apex')
connection = self.engine.connect()
# begin a non-ORM transaction
self.trans = connection.begin()
# bind an individual Session to the connection
DBSession.configure(bind=connection)
self.session = self.Session(bind=connection)