fix connection uri parsing when the host includes a scheme#31465
Conversation
|
Instead of trying to guess what the user wants, I’m more inclined to make this fail directly when the user tries to add the connection object in the first place. |
|
@uranusjr IMO there should not be any problem if the user provide this kind of hosts, since it's a valid host but with a protocol, for ex, if we create the same connection from the UI: Then we use the Airflow CLI to get the connection information: We see that it's successfully parsed and we can use it without any problem, and if I think that the method |
|
I will add some changes it to make it backward compatible |
d085393 to
403d051
Compare
|
It's ready and without a new column, I just updated the methods |
403d051 to
6fe1a5d
Compare
6fe1a5d to
b31e2e7
Compare
amoghrajesh
left a comment
There was a problem hiding this comment.
@hussein-awala the changes mostly look good to me.
Have a few comments
| schemes_count_in_uri = uri.count("://") | ||
| if schemes_count_in_uri > 2: | ||
| raise AirflowException(f"Invalid connection string: {uri}.") | ||
| scheme_in_uri = schemes_count_in_uri == 2 |
There was a problem hiding this comment.
This variable name is rather confusing to me, can we have something else here?
There was a problem hiding this comment.
can you check it now?
|
Hi @hussein-awala , we are about to release 2.6.2, can you address the review comments here so this can be part of 2.6.2 |
amoghrajesh
left a comment
There was a problem hiding this comment.
Thanks for those changes, @hussein-awala
LGTM +1
@ephraimbuddy the review is addressed, can your review the PR? |
29bf3b1 to
05cc1b0
Compare
|
Hi @uranusjr , do you want to take another look? |
* update _parse_from_uri and get_uri methods, and add tests for connection model * some fixes from review (cherry picked from commit 0560881)



closes: #21638
closes: #31460
This PR introduces a solution to address the parsing problem that occurs when the connection host includes a scheme.
^ 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.