当前位置: 首页>>代码示例>>Python>>正文


Python DBSession.execute方法代码示例

本文整理汇总了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']
开发者ID:aytsai,项目名称:ricebowl,代码行数:12,代码来源:register.py

示例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
开发者ID:aytsai,项目名称:ricebowl,代码行数:17,代码来源:register.py

示例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')
开发者ID:aytsai,项目名称:ricebowl,代码行数:6,代码来源:test_cartridge.py

示例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')
开发者ID:aytsai,项目名称:ricebowl,代码行数:6,代码来源:test_cartridge.py


注:本文中的app.model.DBSession.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。