本文整理汇总了Python中database.DatabaseManager.retrieve_attr_from_db方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseManager.retrieve_attr_from_db方法的具体用法?Python DatabaseManager.retrieve_attr_from_db怎么用?Python DatabaseManager.retrieve_attr_from_db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database.DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager.retrieve_attr_from_db方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compare_page
# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import retrieve_attr_from_db [as 别名]
def compare_page():
uuids = request.values.get('uuids', "").split(',')
game_uuids = []
state_uuids = []
for id in uuids:
if dbm.retrieve_attr_from_db('uuid', id, dbm.GAME_CITATION_TABLE):
game_uuids.append(id)
state_uuids.append('NO_ID')
elif dbm.retrieve_attr_from_db('uuid', id, dbm.GAME_SAVE_TABLE):
state = dbm.retrieve_save_state(uuid=id)[0]
state_uuids.append(id)
game_uuids.append(state['game_uuid'])
return render_template('compare.html',
game_uuids=",".join(game_uuids),
state_uuids=",".join(state_uuids)
)
示例2: process_citation_url
# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import retrieve_attr_from_db [as 别名]
def process_citation_url():
while True:
url = (yield)
if not dbm.is_attr_in_db('source_url', url, dbm.GAME_CITATION_TABLE):
click.echo('Extracting url {} through coroutine.'.format(url))
extractor = get_extractor_for_uri(url, get_url_source(url))
extractor.extract()
citation, extracted_options = extractor.create_citation()
citations.append((citation, NEW))
else:
click.echo('Found {} in local db.'.format(url))
citation = dbm.create_cite_ref_from_db(GAME_CITE_REF,
dbm.retrieve_attr_from_db(
'source_url',
url,
dbm.GAME_CITATION_TABLE)[0])
citations.append((citation, OLD))
示例3: get_cite_for_uuid
# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import retrieve_attr_from_db [as 别名]
def get_cite_for_uuid(result):
ref_type = result['tags']
uuid = result['uuid']
if ref_type == GAME_CITE_REF:
table = dbm.GAME_CITATION_TABLE
if ref_type == PERF_CITE_REF:
table = dbm.PERFORMANCE_CITATION_TABLE
if ref_type == STATE_CITE_REF:
table = dbm.GAME_SAVE_TABLE
if ref_type in (GAME_CITE_REF, PERF_CITE_REF):
db_values = dbm.retrieve_attr_from_db('uuid', uuid, table, limit=1)[0]
citation = dbm.create_cite_ref_from_db(ref_type, db_values)
else:
citation = dbm.retrieve_save_state(uuid=uuid)[0]
citation['ref_type'] = STATE_CITE_REF
return citation
示例4: get_duplicates
# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import retrieve_attr_from_db [as 别名]
def get_duplicates(value, field, table_name):
dup_tuples = dbm.retrieve_attr_from_db(field, value, table_name)
return [dict(zip(dbm.headers[table_name], dup)) for dup in dup_tuples]