本文整理汇总了Python中qtools.model.Session.execute方法的典型用法代码示例。如果您正苦于以下问题:Python Session.execute方法的具体用法?Python Session.execute怎么用?Python Session.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtools.model.Session
的用法示例。
在下文中一共展示了Session.execute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __setup_db_context
# 需要导入模块: from qtools.model import Session [as 别名]
# 或者: from qtools.model.Session import execute [as 别名]
def __setup_db_context(self, well_id):
c.well = Session.query(QLBWell).filter_by(id=well_id)\
.options(joinedload_all(QLBWell.channels, innerjoin=True),
joinedload_all(QLBWell.plate, QLBPlate.plate)).first()
if not c.well:
abort(404)
c.reprocess_config_id = self.form_result['reprocess_config_id']
c.analysis_group_id = self.form_result['analysis_group_id']
# check for thing in relational table
if c.reprocess_config_id and c.analysis_group_id:
rec = Session.execute(select([agr]).where(and_(agr.c.analysis_group_id==int(c.analysis_group_id),
agr.c.reprocess_config_id==int(c.reprocess_config_id))))
# check for an existing record
if rec.rowcount > 0:
# awesome, get the reprocess config name
c.reprocess_config = Session.query(ReprocessConfig).get(c.reprocess_config_id)
c.analysis_group = Session.query(AnalysisGroup).get(c.analysis_group_id)
# get the plate metric for the plate
c.well_metric = Session.query(WellMetric)\
.join(PlateMetric)\
.filter(and_(WellMetric.well_id==c.well.id,
PlateMetric.reprocess_config_id==c.reprocess_config_id))\
.options(joinedload_all(WellMetric.well_channel_metrics, innerjoin=True)).first()
else:
c.reprocess_config = None
c.analysis_group = None
else:
c.reprocess_config = None
c.analysis_group = None
if not c.reprocess_config:
# try to find an existing well metric
c.well_metric = Session.query(WellMetric)\
.join(PlateMetric)\
.filter(and_(WellMetric.well_id==c.well.id,
PlateMetric.reprocess_config_id==None))\
.options(joinedload_all(WellMetric.well_channel_metrics, innerjoin=True)).first()
if not c.well_metric:
c.cluster_calc_mode = False
else:
c.cluster_calc_mode = c.well_metric.cnv_calc_mode == QLWellChannelStatistics.CONC_CALC_MODE_CLUSTER