Repository navigation
IBM Db2 provider: skip None-valued extra parameters to avoid KEY=None in connection strings - #72025
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
ColtenOuO
left a comment
There was a problem hiding this comment.
Thanks for the fix -- skipping None-valued extras in get_conn()/get_uri() looks correct and avoids emitting KEY=None to the Db2 driver.
I think there have a few things before this is ready to merge:
- The PR title should clearly describe the specific changes rather than just mentioning which provider were modified.
- I think we need to add a test to prevent the same issue from happening again in the future.
- To keep the branch clean, we should rebase onto main instead of merging.
- Similar to the PR title, commit messages should explain the reasoning and the solution behind the changes in detail, so that future contributors touching similar files can quickly understand the context.
… in connection strings
When a user leaves an optional extra field blank in the Airflow connection
form, the JSON stored in the extra field contains null values (e.g.
{"SSLServerCertificate": null}). Previously these were emitted verbatim
into both the ibm_db connection string (KEY=None;) and the SQLAlchemy URI
query string (?KEY=None), causing the Db2 driver to receive the literal
string "None" as a parameter value. This either triggers a connection
error or silently passes a bad value to the driver.
Fix: skip any extra key whose value is None before building the connection
string in get_conn() and before building the query string in get_uri().
Add parametrized tests covering both methods to prevent regression.
183dc44 to
dc9895f
Compare
Thanks for the review. Did the changes you suggested. Could you please review it again. |
ColtenOuO
left a comment
There was a problem hiding this comment.
LGTM, Thanks! Let's wait for the Commiter or PMC member take a more look.
… get_conn and get_uri
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
… in connection strings (apache#72025) * IBM Db2 provider: skip None-valued extra parameters to avoid KEY=None in connection strings When a user leaves an optional extra field blank in the Airflow connection form, the JSON stored in the extra field contains null values (e.g. {"SSLServerCertificate": null}). Previously these were emitted verbatim into both the ibm_db connection string (KEY=None;) and the SQLAlchemy URI query string (?KEY=None), causing the Db2 driver to receive the literal string "None" as a parameter value. This either triggers a connection error or silently passes a bad value to the driver. Fix: skip any extra key whose value is None before building the connection string in get_conn() and before building the query string in get_uri(). Add parametrized tests covering both methods to prevent regression. * Merge skips-None-extra tests into one parametrized test covering both get_conn and get_uri --------- Co-authored-by: Shubham Kapoor <shubhamkapoor@Shubhams-MacBook-Pro.local>
Description
Skip
None-valued extra parameters when building Db2 connection strings and URIsWhen extra connection parameters contain keys with
Nonevalues (e.g. from a partially-filled connection form), the previous code would emit them as the literal string"None"in the Db2 connection string (KEY=None;) and in the SQLAlchemy URI query string (?KEY=None). Both cases result in either a connection error or silently passing a bad value to the driver.This fix skips
None-valued keys in bothget_conn()(connection string builder) andget_uri()(SQLAlchemy URI builder), so only explicitly configured parameters reach the Db2 driver.Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.Note: The change is small and self-contained and the provider isn't released nor used so I have not created the Git Issue.