-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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: allow db driver distinction on enforced URI params #23769
Conversation
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 with an optional thought
disallow_uri_query_params = {"local_infile"} | ||
enforce_uri_query_params = {"local_infile": 0} | ||
disallow_uri_query_params = { | ||
"mysqldb": {"local_infile"}, | ||
"mysqlconnector": {"allow_local_infile"}, | ||
} | ||
enforce_uri_query_params = { | ||
"mysqldb": {"local_infile": 0}, | ||
"mysqlconnector": {"allow_local_infile": 0}, | ||
} |
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.
thinking out loud: would it be convenient to be able to specify globally disallowed params, too? Something like this:
disallow_uri_query_params = {
"": {"my_globally_disallowed_param"},
"mysqldb": {"local_infile"},
"mysqlconnector": {"allow_local_infile"},
}
(feel free to ignore this idea, as it looks pretty awful 😆)
Codecov Report
@@ Coverage Diff @@
## master #23769 +/- ##
==========================================
- Coverage 67.87% 67.83% -0.04%
==========================================
Files 1924 1924
Lines 74379 74381 +2
Branches 8106 8106
==========================================
- Hits 50484 50457 -27
- Misses 21818 21847 +29
Partials 2077 2077
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 12 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
(cherry picked from commit 6ae5388)
SUMMARY
Parameters on SQLAlchemy URI vary by driver. Currently connections using "mysql+mysqlconnector" break because the engine spec is enforcing an unknown parameter for this driver.
This PR fixes this issue introducing the driver name to
disallow_uri_query_params
andenforce_uri_query_params
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION