Page MenuHomeSoftware Heritage

Add type annotations for swh.core.db.BaseDb

Authored by olasd on Jul 3 2020, 1:24 AM.



Depends on D3394.

Test Plan


Diff Detail

rDCORE Foundations and core functionalities
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

olasd created this revision.Jul 3 2020, 1:24 AM

Build is green

Patch application report for D3398 (id=12049)

Could not rebase; Attempt merge onto 3a612cca29...

Updating 3a612cc..ce1e452
 requirements-test-db.txt     |   1 +
 swh/core/db/      | 175 ++++++++++++++++++++-------
 swh/core/db/tests/ | 282 +++++++++++++++++++++++++++++++++++++------
 3 files changed, 377 insertions(+), 81 deletions(-)
Changes applied before test
commit ce1e4523834b3849813a3800494ebbda515cf760
Author: Nicolas Dandrimont <>
Date:   Fri Jul 3 01:21:04 2020 +0200

    Add type annotations for swh.core.db.BaseDb

commit 7124063e497a30b181b7b85dae4b61f9e4fe5120
Author: Nicolas Dandrimont <>
Date:   Thu Jul 2 13:30:33 2020 +0200

    Reimplement PostgreSQL COPY escaping from first principles
    Instead of the brittle csv we used to use, use postgresql text mode to transfer
    data in the `copy` operation. Reference all relevant bits of the PostgreSQL
    documentation inline with the code.
    This also adds test coverage for most supported types, as well as making sure
    all escaping corner cases are covered.

See for more details.

vlorentz accepted this revision.Jul 3 2020, 8:51 AM
This revision is now accepted and ready to land.Jul 3 2020, 8:51 AM
This revision was automatically updated to reflect the committed changes.