本文整理汇总了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;")