Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ New repository helpers on asyncpg #6465

Merged
merged 8 commits into from
Sep 30, 2024

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Sep 27, 2024

What do these changes do?

This PR implements some helper functions to build repositories effectively on top of asyncpg, which is going to be the replacement of aiopg in the entire repo (see #4529)

  • ✅ New test fixtures to create asyncpg engine in simcore-postgres-database library tests
  • ✨ New utility functions to build repositories and create transactions. Specifically, two context managers:
    • pass_or_acquire_connection: returns an connection or acquires a new one. If the latter, it gets destroyed on exit.
    • transaction_contexts: allows (i.e., database units of work) also across multiple repository calls.
      • NOTE that up to now we could only do this within a single repository call at a time!
    • IMPORTANT: for a better insight see tests/test_utils_repos.py
  • ⚗️ Prototypes of "template" repository class OneResourceRepoDemo using aforementioned utils in tests/test_utils_repos.py. This class also demonstrate how the utils above can be used to build repositories
  • 🗑️ Vendor.has_landing_page was retired

Related issue/s

How to test

cd packages/postgres-database
make install-dev
pytest -vv tests/test_utils_repos.py

Dev-ops checklist

@pcrespov pcrespov self-assigned this Sep 27, 2024
@pcrespov pcrespov added t:enhancement Improvement or request on an existing feature a:database associated to postgres service and postgres-database package t:maintenance Some planned maintenance work labels Sep 27, 2024
@pcrespov pcrespov added this to the MartinKippenberger milestone Sep 27, 2024
@pcrespov pcrespov marked this pull request as ready for review September 27, 2024 15:42
Copy link

codecov bot commented Sep 27, 2024

Codecov Report

Attention: Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.5%. Comparing base (cafbf96) to head (fc478c4).
Report is 600 commits behind head on master.

Files with missing lines Patch % Lines
...abase/src/simcore_postgres_database/utils_repos.py 96.4% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #6465      +/-   ##
=========================================
- Coverage    84.5%   82.5%    -2.1%     
=========================================
  Files          10    1403    +1393     
  Lines         214   58184   +57970     
  Branches       25    1367    +1342     
=========================================
+ Hits          181   48029   +47848     
- Misses         23    9972    +9949     
- Partials       10     183     +173     
Flag Coverage Δ
unittests 82.5% <96.4%> (-2.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...e/src/simcore_postgres_database/models/products.py 100.0% <ø> (ø)
...r/src/simcore_service_webserver/products/_model.py 91.5% <ø> (ø)
...abase/src/simcore_postgres_database/utils_repos.py 96.4% <96.4%> (ø)

... and 1350 files with indirect coverage changes

@pcrespov pcrespov enabled auto-merge (squash) September 27, 2024 17:52
Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice thanks!

Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looking good, please find below once concern about a test

@pcrespov pcrespov disabled auto-merge September 30, 2024 13:20
@pcrespov pcrespov merged commit 52771a9 into ITISFoundation:master Sep 30, 2024
2 checks passed
@pcrespov pcrespov deleted the mai/repo-helpers branch September 30, 2024 13:20
Copy link

mrnicegyu11 pushed a commit to mrnicegyu11/osparc-simcore that referenced this pull request Oct 2, 2024
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Oct 29, 2024
57 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:database associated to postgres service and postgres-database package t:enhancement Improvement or request on an existing feature t:maintenance Some planned maintenance work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants