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


Python DatabaseManager.retrieve_attr_from_db方法代码示例

本文整理汇总了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)
                           )
开发者ID:gamecip,项目名称:citetool-editor,代码行数:19,代码来源:app.py

示例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))
开发者ID:gamecip,项目名称:citetool-editor,代码行数:19,代码来源:citetool_editor.py

示例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
开发者ID:gamecip,项目名称:citetool-editor,代码行数:19,代码来源:citetool_editor.py

示例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]
开发者ID:gamecip,项目名称:citetool-editor,代码行数:5,代码来源:citetool_editor.py


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