-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Move BaseHook
class to task SDK
#51873
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
base: main
Are you sure you want to change the base?
Conversation
from airflow.models import Connection | ||
from airflow.providers_manager import ProvidersManager | ||
from airflow.sdk import BaseHook |
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.
Is Thors only needed for test conn? If so can we delay the import to the fn, and handle it missing with a nice error message?
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.
Had a similar thought and tried implementing it with Connection instead: #51834
@@ -26,7 +26,7 @@ | |||
from requests import Session | |||
|
|||
from airflow.exceptions import AirflowException | |||
from airflow.hooks.base import BaseHook | |||
from airflow.sdk import BaseHook |
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.
All these will need a try/except so they continue to work on Airflow 2
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.
Yeah let me make that change!
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.
Pushed a change via: b544139
closes: #51672
Moving the BaseHook class into task SDK, exactly where it should live similar to other base classes in sdk like notifiers, operators etc.
Testing: Running by all the methods defined on BaseHook -- old vs new
Running with the new path
DAG:
Running with the older path to check backcompat
^ 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.rst
or{issue_number}.significant.rst
, in airflow-core/newsfragments.