-
Notifications
You must be signed in to change notification settings - Fork 14.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
Make dbapi inherit get_uri from connection #21764
Conversation
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
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.
NICE!.
BTW. I looked it up - the get_uri method was added (and with plenty of tests) in Airflow 2.0.0 and already present in the 1.0 verson of all providers so it shuld be backwards-compatible in all directions. I wonder why we have not updated it then :)
@potiuk which one did you look up? the one in dbapi was pretty buggy and I am not sure why it worked :-). The one in connection is a bit better, but I am confused why we use so little standardization here while url encoding is actually pretty hard. |
I have a feeling Connection.get_uri is a "relatively" recent addition, I think added for |
Yep. It is. And I think this is simply a very straightforward manifestation of "If is is not used, it likely does not work". From what I looked today the "Connection" get_uri() was added in 2.0.0a. The only You can instantiate an SQLAlchemy session and run a raw query - maybe - but then you can run query via DBApi's "run" method anyway - so it makes no sense to instantiate the sqlalchemy engine for it. So while we likely should keep backwards compatibility (just in case) with even "more correct" URIs returned, I think hardly anyone uses it or make some assumptions about returned URI correctness. |
Interesting! Maybe we should move away from "conn_type" etc and just rely on people specifying a URI (as happens in others systems) and allow for specifying a key or username/password? And btw @dimberman is relying on this function in the new sql-decorator (to be renamed I guess). |
DBApi has its own get_uri method which does not deal with quoting properly and neither with empty passwords. Connection also has a get_uri method that deals properly with the above issues. This also fixes issues with RFC compliancy.
ba7b69e
to
c8eaf43
Compare
I think connections need redesign badly. There are a number of ambiguities and duplications there (especially in-connection with extras and UI). And I also think @dimberman you already take steps in that direction too right ? :D. |
DBApi has its own get_uri method which does not deal
with quoting properly and neither with empty passwords.
Connection also has a get_uri method that deals properly
with the above issues.
@dimberman @ashb