Skip to content
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

Fix .explain() in Django >=4.0 #91

Merged
merged 1 commit into from
May 8, 2024
Merged

Fix .explain() in Django >=4.0 #91

merged 1 commit into from
May 8, 2024

Conversation

SupImDos
Copy link
Contributor

@SupImDos SupImDos commented May 8, 2024

It looks like there was a change in Django 4.0 that broke the django-cte explain functionality.

See:

This wasn't picked up by the unit tests because we manually set explain_query = True (which is now unused) rather than call the .explain() queryset method.

This PR adds some logic to retrieve explain_query for Django < 4.0, and explain_info for Django >= 4.0. It also updates the unit tests to call .explain() (which appears to work on sqlite3 as far as I can tell).

There's probably a cleaner way to do this, so feel free rework if you see fit.

@millerdev millerdev merged commit 744d745 into dimagi:master May 8, 2024
15 checks passed
@millerdev
Copy link
Contributor

Thank you for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants