本文整理汇总了Python中mediacore.model.meta.DBSession.configure方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.configure方法的具体用法?Python DBSession.configure怎么用?Python DBSession.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mediacore.model.meta.DBSession
的用法示例。
在下文中一共展示了DBSession.configure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_model
# 需要导入模块: from mediacore.model.meta import DBSession [as 别名]
# 或者: from mediacore.model.meta.DBSession import configure [as 别名]
def init_model(engine):
"""Call me before using any of the tables or classes in the model."""
DBSession.configure(bind=engine)
from mediacore.model import meta
meta.metadata.bind = engine
meta.engine = engine
示例2: init_model
# 需要导入模块: from mediacore.model.meta import DBSession [as 别名]
# 或者: from mediacore.model.meta.DBSession import configure [as 别名]
def init_model(engine, table_prefix=None):
"""Call me before using any of the tables or classes in the model."""
DBSession.configure(bind=engine)
from mediacore.model import meta
meta.metadata.bind = engine
meta.engine = engine
# Change all table names to include the given prefix. This can't be
# easily done before the models are added to the metadata because
# that happens on import, before the config is available.
if table_prefix:
table_prefix = table_prefix.rstrip('_') + '_'
for table in meta.metadata.sorted_tables:
table.name = table_prefix + table.name
示例3: init_model
# 需要导入模块: from mediacore.model.meta import DBSession [as 别名]
# 或者: from mediacore.model.meta.DBSession import configure [as 别名]
def init_model(engine):
"""Call me before using any of the tables or classes in the model."""
DBSession.configure(bind=engine)