本文整理汇总了Python中app.model.DBSession.execute方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.execute方法的具体用法?Python DBSession.execute怎么用?Python DBSession.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.model.DBSession
的用法示例。
在下文中一共展示了DBSession.execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getNextSeq
# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import execute [as 别名]
def getNextSeq(seqname):
"""
Return the next value from a database sequence given the sequence name
@param seqname: Name of sequence
@type seqname: str
@return: the next value from the database sequence
@rtype: int
"""
return DBSession.execute(text("select nextval(:seqname) as myseq"), { 'seqname' : seqname}).fetchone()['myseq']
示例2: generateMolRegId
# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import execute [as 别名]
def generateMolRegId(prefixId):
"""
Generate the next reg ID in a sequence for a molecule, given the prefix Id
@param prefixId: The ID of the prefix used for the reg ID
@type prefixId: int
@return: generated reg ID
@rtype: str
"""
log.debug('Retrieving mol_prefix_name for %d' % int(prefixId))
prefix = DBSession.execute(text('select mol_prefix_name from mol_prefix where mol_prefix_id = :prefix_id'), { 'prefix_id' : prefixId}).fetchone()['mol_prefix_name']
seq = getNextSeq('regseq_' + prefix)
mol_reg_id = prefix + "-" + str(seq)
log.debug('Generated mol registration ID of %s' % mol_reg_id)
return mol_reg_id
示例3: testCompareSmartsToMDL
# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import execute [as 别名]
def testCompareSmartsToMDL(self):
"""Can compare a SMARTS pattern to an MDL Mol string"""
r=DBSession.execute(text("select chem.compareSmartsToMol('c', :molstr) as comp"), dict(molstr=self.molstr)).fetchone()
ok_(r['comp'], 'SMARTS pattern failed to match MDL Mol string')
示例4: testCompareSmartsToSmiles
# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import execute [as 别名]
def testCompareSmartsToSmiles(self):
"""Can compare a SMARTS pattern to a SMILES string"""
r=DBSession.execute(text("select chem.compareSmartsToSmiles('c', 'c1ccccc1') as comp")).fetchone()
ok_(r['comp'], 'SMARTS pattern failed to match SMILES string')