-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Patch CursorWrapper dynamically to allow multiple base classes. #1820
Conversation
When the debug SQL logs are enabled, the wrapper class is CursorDebugWrapper not CursorWrapper. Since we have inspections based on that specific class they are removing the CursorDebugWrapper causing the SQL logs to not appear. This attempts to dynamically patch the CursorWrapper or CursorDebugWrapper with the functionality we need. This doesn't do a full regression test, but it may be possible to get it to work with: TEST_ARGS='--debug-sql' make test Which causes the current set of tests to fail since they are keyed to CursorWrapper.
@living180 I can't add you to the requested reviewers, but I'd appreciate you taking a look at this PR. |
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.
LGTM. Thanks!
@matthiask sorry, can you review that last commit too. It's a bit of a hack, but it's either that or inspecting |
I'm likely to cut a release after this PR. |
Thanks, I think the way it's implemented makes sense! |
Didn't have time to review this until just now, but the implementation looks good and a basic smoke test passes for me. The only improvement I'd suggest would be a bit of bike-shedding by renaming |
Good enough for me. |
When the debug SQL logs are enabled, the wrapper class is CursorDebugWrapper not CursorWrapper. Since we have inspections based on that specific class they are removing the CursorDebugWrapper causing the SQL logs to not appear.
This attempts to dynamically patch the CursorWrapper or CursorDebugWrapper with the functionality we need.
This doesn't do a full regression test, but it may be possible to get it to work with:
Which causes the current set of tests to fail since they are keyed to CursorWrapper.
Fixes #1814
Checklist:
docs/changes.rst
.