-
Notifications
You must be signed in to change notification settings - Fork 92
Materialized view django model #5195
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
Conversation
This reverts commit 01962f8.
| "model": "clickhouse_search.keylookupsnvindel", | ||
| "pk": "1-10439-AC-A", | ||
| "fields": { | ||
| "key": 1, |
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.
rather than directly insert fixture rows into the clinvar join table, insert into the all variants tables and rely on the materialized view to work correctly. Changing the data like this ensures that out unit tests will catch if those views stop working as intended
…erialized-view-django-model
…erialized-view-django-model
…erialized-view-django-model
…erialized-view-django-model
…erialized-view-django-model
clickhouse_search/backend/base.py
Outdated
|
|
||
| class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): | ||
|
|
||
| def _is_materialzed_view(self, model): |
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.
_is_materialzed_view -> _is_materialized_view
|
|
||
| def _get_materialized_view_engine_expression(self, model): | ||
| sql = f'TO {self._table_name(model._meta, model._meta.to_table)}' | ||
| if getattr(model._meta, 'refreshable', False): |
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.
One feature that was added in the new reference data views that wasn't in the existing ones was the EMPTY keyword, which prevents an immediate refresh when the view is created.
It's less important for the gt_stats views (when they are created everything should be empty), but we should have support for it, and default to using it, going forwards.
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.
here is an example
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.
I am going to keep this out of scope for now and when I move the reference data views to be defined as models I will extend the behavior
…erialized-view-django-model
Creates a django model class for materialized views and moves all of our existing materialized views from templated
RunSqldefinitions into these models. This makes it clearer what "tables" exist in the database and their relationship to one another just by looking at the models files and not needing to go back through old migrations to find definitions