-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Add null check for host in Amazon Redshift connection #31567
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
Conversation
… into redhift-conn-fix
phanikumv
left a comment
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.
can you add tests for this change please
hussein-awala
left a comment
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.
Could you add a test for this fix to test the different cases (loading from cluster_identifier, loading from host and raising an exception if both are not preset)?
ashb
left a comment
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.
Tests please!
@phanikumv @ashb @hussein-awala added the test cases here: 4e643c3 |
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
hussein-awala
left a comment
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.
I just pushed a commit to simplify the tests, you can change it if you think that there is something missing
This is a bug in the current implementation as per the PR.
When user passes the following as part of redshift connection, it would break:
The following image shows that the

hostis not set in the connection butcluster_identifieris set.Even though the
cluster_identifieris set here this would break with the following error on the line as host is not set becauseconn.hostis evaluated first and when we split it toNoneTypeobject it would throw attribute error.Following is the test we did.
This is a bug in the current implementation for all users when
hostis not set in the connection (not only for default connections). This would require a null check forconn.host.closes: #31551
Added a null check for
conn.host.conn.host.split(".")[0]is compiled regardless of the extra values.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.