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

add region to database #42

Merged
merged 2 commits into from
Aug 23, 2024
Merged

add region to database #42

merged 2 commits into from
Aug 23, 2024

Conversation

elfkuzco
Copy link
Collaborator

Rationale

Add Region table for keeping information of countries and mirror location.
In order to keep the data in the db compatible with the schema changes, the region data for Country and Mirror are set to None by default. However, CLI commands which update mirrors and countries update this field accordingly.

To synchronize the data in the db fully, one should create the regions first using mirrors-qa-backend create-countries < csv-file.
Afterwards, mirrors-qa-backend update-mirrors. This updates the region data for all the mirrors in the database.

This resolves #38

Changes

  • add region model to database
  • add region relationship to country table
  • add region relationship to mirrors table. This would simplify db queries while generating mirrorbrain config on metabase
  • add cli subcommand that fills the region table and updates the list of countries from csv file. Run mirrors-qa-backend create-countries -h to see the arguments
  • update mirror country information via update-mirrors subcommand

@codecov-commenter
Copy link

codecov-commenter commented Aug 22, 2024

Codecov Report

Attention: Patch coverage is 73.62637% with 24 lines in your changes missing coverage. Please review.

Project coverage is 72.75%. Comparing base (95c2609) to head (edd6bb4).
Report is 4 commits behind head on main.

Files Patch % Lines
backend/src/mirrors_qa_backend/entrypoint.py 0.00% 12 Missing ⚠️
backend/src/mirrors_qa_backend/db/mirrors.py 66.66% 2 Missing and 3 partials ⚠️
backend/src/mirrors_qa_backend/cli/country.py 88.00% 1 Missing and 2 partials ⚠️
backend/src/mirrors_qa_backend/db/region.py 81.25% 2 Missing and 1 partial ⚠️
backend/src/mirrors_qa_backend/extract.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #42      +/-   ##
==========================================
- Coverage   72.83%   72.75%   -0.08%     
==========================================
  Files          28       30       +2     
  Lines         795      881      +86     
  Branches       70       81      +11     
==========================================
+ Hits          579      641      +62     
- Misses        204      222      +18     
- Partials       12       18       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@elfkuzco elfkuzco requested a review from rgaudin August 22, 2024 14:33
Copy link
Member

@rgaudin rgaudin left a comment

Choose a reason for hiding this comment

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

LGTM ; please check the minor suggestions

backend/src/mirrors_qa_backend/db/region.py Outdated Show resolved Hide resolved
backend/src/mirrors_qa_backend/schemas.py Outdated Show resolved Hide resolved
backend/src/mirrors_qa_backend/schemas.py Outdated Show resolved Hide resolved
backend/src/mirrors_qa_backend/entrypoint.py Outdated Show resolved Hide resolved
@elfkuzco elfkuzco merged commit 656e88d into main Aug 23, 2024
4 checks passed
@elfkuzco elfkuzco deleted the region-model branch August 23, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce Regions
3 participants