-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Add property conn_name and connection to dbapi_hook #7903
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
Add property conn_name and connection to dbapi_hook #7903
Conversation
|
We have one subclass hook still WIP in #7901 |
ebfdfb0 to
e5aa2a4
Compare
|
For reviewer, in cf0a5f6 I just add property And then I find out we could change |
potiuk
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.
|
My laptop almost power off and I forget the charger in office, have to continue in tomorrow. |
1b07b54 to
81acdae
Compare
b33346b to
124c19d
Compare
Codecov Report
@@ Coverage Diff @@
## master #7903 +/- ##
===========================================
- Coverage 88.31% 33.26% -55.05%
===========================================
Files 935 935
Lines 45170 45170
===========================================
- Hits 39892 15027 -24865
- Misses 5278 30143 +24865
Continue to review full report at Codecov.
|
|
And for now, the solution two pass CI, and I think it work. The question is, should we take solution one and change But if we take solution two, |
124c19d to
c7e90c7
Compare
591bea2 to
31fd691
Compare
75ef759 to
9b60c0e
Compare
|
Two solutions CI passed, we have two fix solutions here, I prefer the second one, and it also the PR final status
- def get_connection(self, conn_id: Optional[str] = None) -> Connection:
+ def get_connection(self, conn_id: Optional[str] = None) -> Connection: # type: ignore
|
|
Reopen this stale PR |
|
@feluelle @potiuk @kaxil @kaxil @turbaszek I think I need one approving review here. I checked and find out there no |
|
Ok, we have +1 here, if no one disapproval here in a few day I will merge this patch to master. |
|
Please rebase once again - just to be sure. :) It is very long ago since you last pushed a commit. |
1748118 to
5330d27
Compare
|
Thanks @turbaszek @feluelle, now I rebase and push to restart the CI, will merge when it pass |
feluelle
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.
Actually I am a bit confused by all these connection, _connection, ... parameters.
Wouldn't it be easier if we just use the conn_id like we do in other hooks which are not based on dbapi_hook ?
airflow/providers/odbc/hooks/odbc.py
Outdated
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.
| def connection_(self): | |
| def connection(self): |
You can overwrite it.
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.
This is unrelated.
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 have to change it to pass CI, I have no idea why previous code could pass the CI, mypy will raise error cause aws_access_key_id, aws_secret_access_key maybe not define
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.
Please use the Connection class to init a connection like in the other cases.
For example:
self.conn = mock.Mock(return_value=Connection(...))|
So my suggestion is to remove As it is now I am not a fan of it anymore I am sorry @zhongjiajie but this looks really too complex, don't you think? |
|
I think we should keep |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
* use conn_name to get dbapi_hook default_conn_name * use get_connection get database connection with default conn_name
d9cf217 to
53f92d9
Compare
|
@zhongjiajie Are you going to carry on with this PR? Where did we get to with it when we left off? |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
Issue link: WILL BE INSERTED BY boring-cyborg
Make sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, 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 UPDATING.md.
Read the Pull Request Guidelines for more information.