Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/postgresql/db.py
Show All 24 Lines | def jsonize(d): | ||||
return _jsonize(dict(d) if d is not None else None) | return _jsonize(dict(d) if d is not None else None) | ||||
class Db(BaseDb): | class Db(BaseDb): | ||||
"""Proxy to the SWH DB, with wrappers around stored procedures | """Proxy to the SWH DB, with wrappers around stored procedures | ||||
""" | """ | ||||
current_version = 178 | current_version = 180 | ||||
def mktemp_dir_entry(self, entry_type, cur=None): | def mktemp_dir_entry(self, entry_type, cur=None): | ||||
self._cursor(cur).execute( | self._cursor(cur).execute( | ||||
"SELECT swh_mktemp_dir_entry(%s)", (("directory_entry_%s" % entry_type),) | "SELECT swh_mktemp_dir_entry(%s)", (("directory_entry_%s" % entry_type),) | ||||
) | ) | ||||
@stored_procedure("swh_mktemp_revision") | @stored_procedure("swh_mktemp_revision") | ||||
def mktemp_revision(self, cur=None): | def mktemp_revision(self, cur=None): | ||||
▲ Show 20 Lines • Show All 390 Lines • ▼ Show 20 Lines | def revision_missing_from_list(self, revisions, cur=None): | ||||
((id,) for id in revisions), | ((id,) for id in revisions), | ||||
) | ) | ||||
revision_add_cols = [ | revision_add_cols = [ | ||||
"id", | "id", | ||||
"date", | "date", | ||||
"date_offset", | "date_offset", | ||||
"date_neg_utc_offset", | "date_neg_utc_offset", | ||||
"date_offset_bytes", | |||||
"committer_date", | "committer_date", | ||||
"committer_date_offset", | "committer_date_offset", | ||||
"committer_date_neg_utc_offset", | "committer_date_neg_utc_offset", | ||||
"committer_date_offset_bytes", | |||||
"type", | "type", | ||||
"directory", | "directory", | ||||
"message", | "message", | ||||
"author_fullname", | "author_fullname", | ||||
"author_name", | "author_name", | ||||
"author_email", | "author_email", | ||||
"committer_fullname", | "committer_fullname", | ||||
"committer_name", | "committer_name", | ||||
"committer_email", | "committer_email", | ||||
"metadata", | "metadata", | ||||
"synthetic", | "synthetic", | ||||
"extra_headers", | "extra_headers", | ||||
"raw_manifest", | |||||
] | ] | ||||
revision_get_cols = revision_add_cols + ["parents"] | revision_get_cols = revision_add_cols + ["parents"] | ||||
def origin_visit_add(self, origin, ts, type, cur=None): | def origin_visit_add(self, origin, ts, type, cur=None): | ||||
"""Add a new origin_visit for origin origin at timestamp ts. | """Add a new origin_visit for origin origin at timestamp ts. | ||||
Args: | Args: | ||||
▲ Show 20 Lines • Show All 732 Lines • ▼ Show 20 Lines | |||||
release_add_cols = [ | release_add_cols = [ | ||||
"id", | "id", | ||||
"target", | "target", | ||||
"target_type", | "target_type", | ||||
"date", | "date", | ||||
"date_offset", | "date_offset", | ||||
"date_neg_utc_offset", | "date_neg_utc_offset", | ||||
"date_offset_bytes", | |||||
"name", | "name", | ||||
"comment", | "comment", | ||||
"synthetic", | "synthetic", | ||||
"raw_manifest", | |||||
"author_fullname", | "author_fullname", | ||||
"author_name", | "author_name", | ||||
"author_email", | "author_email", | ||||
] | ] | ||||
release_get_cols = release_add_cols | release_get_cols = release_add_cols | ||||
def origin_snapshot_get_all(self, origin_url: str, cur=None) -> Iterable[Sha1Git]: | def origin_snapshot_get_all(self, origin_url: str, cur=None) -> Iterable[Sha1Git]: | ||||
cur = self._cursor(cur) | cur = self._cursor(cur) | ||||
▲ Show 20 Lines • Show All 290 Lines • Show Last 20 Lines |