當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。