Skip to content

943 MSSQL POC #1452

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
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion simple_history/management/commands/clean_duplicate_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,19 @@ def _process(self, to_process, date_back=None, dry_run=True):
pk__in=(m_qs.values_list(model._meta.pk.name).distinct())
)

for o in model_query.iterator():
def get_backend_name(model_class):
from django.db import connections, router

db_alias = router.db_for_read(model_class)
return connections[db_alias].vendor

backend_name = get_backend_name(model)
if backend_name != "microsoft":
_iterator = model_query.iterator()
else:
_iterator = model_query

for o in _iterator:
self._process_instance(o, model, stop_date=stop_date, dry_run=dry_run)

def _process_instance(self, instance, model, stop_date=None, dry_run=True):
Expand Down