本文整理匯總了Python中data.database.Database.fetch方法的典型用法代碼示例。如果您正苦於以下問題:Python Database.fetch方法的具體用法?Python Database.fetch怎麽用?Python Database.fetch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類data.database.Database
的用法示例。
在下文中一共展示了Database.fetch方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: load_scores
# 需要導入模塊: from data.database import Database [as 別名]
# 或者: from data.database.Database import fetch [as 別名]
def load_scores(scoring_method, unweighted, unstressed):
method_mean, method_addition = SCORING_METHODS[scoring_method]
sql = "select word, score from scores where \
unweighted = {} and unstressed = {} \
and method_mean = {} and method_addition = {};".format(
unweighted, unstressed, method_mean, method_addition
)
return Database.fetch(sql)
示例2: load_phonemes
# 需要導入模塊: from data.database import Database [as 別名]
# 或者: from data.database.Database import fetch [as 別名]
def load_phonemes(unweighted, unstressed):
next_phonemes = 'next_phonemes_unweighted' if unweighted else 'next_phonemes'
sql = "select phoneme, {} from phonemes where unstressed = {};".format(
next_phonemes, unstressed
)
results = Database.fetch(sql)
output = {}
for phoneme, next_phonemes in results:
output[phoneme] = json.loads(next_phonemes)
return output
示例3: load_words
# 需要導入模塊: from data.database import Database [as 別名]
# 或者: from data.database.Database import fetch [as 別名]
def load_words():
return Database.fetch("select * from words;")