-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Create UsingSQLFromBaseHookRule to ease upgrade to Airflow 2.0 #11039
Comments
Hi @turbaszek 👋🏼 could I work on this? I think I'm almost done with the GCP account service key rule. |
@pcandoalmeida I assigned you to this ticket. |
Hi @turbaszek 👋🏼 I wanted to check that I'm understanding this rule correctly. Here, no configuration is set; either, users will be extending the |
Yes, it's all about using the removed methods.
I'm personally in favor of checking if users use any custom operator - if yes we should inform them about this change. I'm afraid that checking this with 100% of accuracy may be really hard. @mik-laj @kaxil what is your opinion? |
Agree. If it proves too tricky, could we return a blanket |
I think yes. We may consider introducing in checker a new type "WARNING" (next to "SUCCESS" and "FAIL"). |
Hey @turbaszek is the above work something I could do perhaps? If it's straightforward, I could perhaps implement it and then try and finish this rule 😃 |
@pcandoalmeida feel free to give it a shot 🚀 |
@turbaszek I think I have a solution. We can basically check any hook that inherits from base_hook and ensure that they don't use the function. Do you think this would work? |
We can, but how? We should not only check custom hooks imported in DAGs but also custom operators that may use BaseHook somewhere. |
Done in #12730 |
This issue is part of #8765
Rule
Create
UsingSQLFromBaseHookRule
which corresponds toentry in UPDATING.md. This rule should allow users to check if their current configuration needs any adjusting
before migration to Airflow 2.0.
How to guide
To implement a new rule, create a class that inherits from
airflow.upgrade.rules.base_rule.BaseRule
.It will be auto-registered and used by
airflow upgrade-check
command. The custom rule class has to havetitle
,description
properties and should implementcheck
method which returns a list of error messages in case ofincompatibility.
For example:
airflow/airflow/upgrade/rules/conn_type_is_not_nullable.py
Lines 25 to 42 in ea36166
Remember to open the PR against
v1-10-test
branch.The text was updated successfully, but these errors were encountered: