Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/storage/db.py
# Copyright (C) 2015-2018 The Software Heritage developers | # Copyright (C) 2015-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from typing import Dict, Iterable, Iterator, List | from typing import Dict, Iterable, Iterator, List | ||||
from swh.core.db import BaseDb | from swh.core.db import BaseDb | ||||
from swh.core.db.db_utils import execute_values_generator, stored_procedure | from swh.core.db.db_utils import execute_values_generator, stored_procedure | ||||
from swh.model import hashutil | from swh.model import hashutil | ||||
from .interface import Sha1 | from .interface import Sha1 | ||||
class Db(BaseDb): | class Db(BaseDb): | ||||
"""Proxy to the SWH Indexer DB, with wrappers around stored procedures""" | """Proxy to the SWH Indexer DB, with wrappers around stored procedures""" | ||||
content_mimetype_hash_keys = ["id", "indexer_configuration_id"] | content_mimetype_hash_keys = ["id", "indexer_configuration_id"] | ||||
current_version = 134 | |||||
def _missing_from_list( | def _missing_from_list( | ||||
self, table: str, data: Iterable[Dict], hash_keys: List[str], cur=None | self, table: str, data: Iterable[Dict], hash_keys: List[str], cur=None | ||||
): | ): | ||||
"""Read from table the data with hash_keys that are missing. | """Read from table the data with hash_keys that are missing. | ||||
Args: | Args: | ||||
table: Table name (e.g content_mimetype, content_language, | table: Table name (e.g content_mimetype, content_language, | ||||
▲ Show 20 Lines • Show All 508 Lines • Show Last 20 Lines |