-
-
Notifications
You must be signed in to change notification settings - Fork 13
Refactor app.main for clearer database setup #2586
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
Draft
pylipp
wants to merge
27
commits into
master
Choose a base branch
from
refactor-app-main
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
537aa3d
Refactor app.main
pylipp b401bd8
Move replica test
pylipp eee060e
Update comment
pylipp d461cad
Move execute_sql utility function into db module
pylipp 53ca16c
Avoid usages of global db object
pylipp 559cb2d
Clearer DatabaseManager implementation
pylipp 64b496f
Add utility function to get all data models
pylipp 9f5c4ce
Make execute_sql independent of db.database and db.replica
pylipp 03a7c54
Explicitly declare Model subclasses
pylipp d8fe65c
Merge remote-tracking branch 'origin/master' into refactor-app-main
pylipp fb2cc7c
Fixup
pylipp c2f4655
Merge remote-tracking branch 'origin/master' into refactor-app-main
pylipp 52bdba1
comments
pylipp e7cd85f
Utility method for current database
pylipp 08a0667
readme
pylipp 21740bb
fix
pylipp a215f59
Revert "fix"
pylipp 9780e95
Properly tear down dev_app fixture
pylipp 42f905c
Update execute_sql and docstrings
pylipp ebe6460
Avoid binding DB in endpoint tests to pollute other tests
pylipp de0eaa1
Explicitly bind models to DB in model_tests conftest
pylipp 144e965
Move endpoint fixtures into correct conftest
pylipp 453a956
Slim down fixture for creating testing database
pylipp 34a3bbc
Update comment and rename function
pylipp a29e5da
Merge remote-tracking branch 'origin/master' into refactor-app-main
pylipp dfaf423
Use DB replica for resolving ResolvedLink fields
pylipp 722917e
Correctly test DatabaseManager.connect_db runtime error
pylipp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,6 @@ | |
| enable_standard_product, | ||
| ) | ||
| from ..business_logic.warehouse.qr_code.crud import create_qr_code | ||
| from ..db import db | ||
| from ..enums import ( | ||
| BoxState, | ||
| HumanGender, | ||
|
|
@@ -235,7 +234,7 @@ def _fetch_bases_and_users(self): | |
|
|
||
| org_ids = {b.id: b.organisation_id for b in bases} | ||
|
|
||
| cursor = db.database.execute_sql( | ||
| cursor = Base._meta.database.execute_sql( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use current_database() ? |
||
| """\ | ||
| SELECT cuc.camp_id, group_concat(u.id ORDER BY u.id) FROM cms_users u | ||
| INNER JOIN cms_usergroups_camps cuc | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.