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

#2114 repeating query in django view #2158

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Pokapiec
Copy link

What does this pull request do?

In this PR i add another condition to elif statement in utils.encoding.transform function to handle displaying representation of django QuerySet object in custom way. We need to do it because if we try to execute repr function on unexecuted QuerySet which causes Timeout on database, it will execute by utils.encoding.transform function.

I also added a simple test simulating database Timeout.

By overwriting _result_cache on django QuerySet object we ensure that django will not try to execute any query to db.

Related issues

Closes #2114

Copy link

cla-checker-service bot commented Nov 25, 2024

❌ Author of the following commits did not sign a Contributor Agreement:
d0a94bd, 66c8991,

Please, read and sign the above mentioned agreement if you want to contribute to this project

@github-actions github-actions bot added agent-python community Issues opened by the community triage Issues awaiting triage labels Nov 25, 2024
@Pokapiec
Copy link
Author

@xrmx this is the PR i created to resolve this issue #2114 we discussed earlier. I wanted to add this transformation logic to django contrib code but i couldn't make it work so i had to move it to transform func. Let me know if there is a better way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-python community Issues opened by the community triage Issues awaiting triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repeating query in django view that failed due to OperationalError (timeout)
2 participants