-
Notifications
You must be signed in to change notification settings - Fork 332
Open
Description
For an import job, I would like to disable the aggregation temporarily to improve performance and reduce the risk of deadlocks.
A context manager seems like a suitable interface for such a feature, like so:
with aggregations_disabled():
# trigger model inserts / updates without triggering aggregation
...
A quick and dirty way would be to add (actually, prepend) a line to construct_aggregate_queries
like so:
def construct_aggregate_queries(self):
if self.aggregation_disabled:
return
...
The context manager then implemented like:
@contextmanager
def aggregations_disabled():
manager.aggregation_disabled = True
yield
manager.aggregation_disabled = False
@kvesteri, do you have any thoughts on feasibility of this approach? I'm happy to submit a PR for the feature.
tspng
Metadata
Metadata
Assignees
Labels
No labels