本文整理汇总了Python中meta.Session.configure方法的典型用法代码示例。如果您正苦于以下问题:Python Session.configure方法的具体用法?Python Session.configure怎么用?Python Session.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meta.Session
的用法示例。
在下文中一共展示了Session.configure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_model
# 需要导入模块: from meta import Session [as 别名]
# 或者: from meta.Session import configure [as 别名]
def init_model(engine):
"""Call me before using any of the tables or classes in the model"""
sm = orm.sessionmaker(autoflush = True, autocommit = False, bind = engine)
meta.engine = engine
meta.Session = orm.scoped_session(sm)
Session.configure(bind = engine)
示例2: __init__
# 需要导入模块: from meta import Session [as 别名]
# 或者: from meta.Session import configure [as 别名]
def __init__(self):
"""Load initial application settings from database """
Application.__init__(self)
# setup the database session
database = 'sqlite:///%s'%os.path.join(APP_DIR,config.get('Inkcut','database_dir'),config.get('Inkcut','database_name'))
log.info("Database: %s"%database)
engine = create_engine(database)
Session.configure(bind=engine)
self.session = Session()
self.job = None
self._flags = {'block_callbacks':True}
示例3: __init__
# 需要导入模块: from meta import Session [as 别名]
# 或者: from meta.Session import configure [as 别名]
def __init__(self):
"""Load initial application settings from database """
# setup the database session
engine = create_engine('sqlite:///%s'%os.path.join(APP_DIR,config.get('Inkcut','database_dir'),config.get('Inkcut','database_name')))
Session.configure(bind=engine)
self.session = Session()
self.job = None
self.ui = {
'main_window':MainWindow(self),
'device_dialog':DeviceDialog(self),
}
self.statusbar = self.ui['main_window'].widgets['statusbar']
示例4: init_model
# 需要导入模块: from meta import Session [as 别名]
# 或者: from meta.Session import configure [as 别名]
def init_model(db_uri):
engine = create_engine(db_uri)
Session.configure(bind=engine)