-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
refactor custom app routing #28099
refactor custom app routing #28099
Conversation
|
||
# map to reporting DB alias | ||
with override_settings(CUSTOM_DB_ROUTING={'custom_app': 'icds-ucr-citus'}), \ | ||
override_engine('icds-ucr-citus', '', db_alias='icds-ucr'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E127 continuation line over-indented for visual indent
# map to reporting DB alias | ||
with override_settings(CUSTOM_DB_ROUTING={'custom_app': 'icds-ucr-citus'}), \ | ||
override_engine('icds-ucr-citus', '', db_alias='icds-ucr'): | ||
self.assertIs(False, allow_migrate(DEFAULT_DB_ALIAS, 'custom_app')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E117 over-indented
|
||
AAA_DB_ENGINE_ID = 'aaa-data' | ||
|
||
def get_aaa_db_alias(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E302 expected 2 blank lines, found 1
elif app_label == AAA_APP: | ||
engine_id = AAA_DB_ENGINE_ID | ||
if not write: | ||
return connection_manager.get_load_balanced_read_db_alias(AAA_DB_ENGINE_ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this load balancing is removed but it's not active on any environment anyway. I think the original code was just copied from the ICDS code at the time.
This is now love on |
@@ -1396,6 +1398,13 @@ | |||
if 'corehq.sql_db.routers.MultiDBRouter' not in DATABASE_ROUTERS: | |||
DATABASE_ROUTERS.append('corehq.sql_db.routers.MultiDBRouter') | |||
|
|||
# Mapping of app_label to DB name or reporting DB alias (see REPORTING_DATABASES) | |||
CUSTOM_DB_ROUTING = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the plan to do this via commcare-cloud setting override?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUMMARY
Refactor app custom app routing to be defined in settings
related localsettings change: dimagi/commcare-cloud#3972