Page MenuHomeSoftware Heritage

Add type annotations for swh.core.db.BaseDb
ClosedPublic

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

Details

Summary

Depends on D3394.

Test Plan

mypy

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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
Fast-forward
 requirements-test-db.txt     |   1 +
 swh/core/db/__init__.py      | 175 ++++++++++++++++++++-------
 swh/core/db/tests/test_db.py | 282 +++++++++++++++++++++++++++++++++++++------
 3 files changed, 377 insertions(+), 81 deletions(-)
Changes applied before test
commit ce1e4523834b3849813a3800494ebbda515cf760
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Fri Jul 3 01:21:04 2020 +0200

    Add type annotations for swh.core.db.BaseDb

commit 7124063e497a30b181b7b85dae4b61f9e4fe5120
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
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 https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/17/ 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.