potiuk commented on code in PR #22974:
URL: https://github.com/apache/airflow/pull/22974#discussion_r849462976
##########
airflow/providers/dbt/cloud/example_dags/example_dbt_cloud.py:
##########
@@ -22,7 +22,7 @@
try:
from airflow.operators.empty import EmptyOperator as DummyOperator
except ModuleNotFoundError:
- from airflow.operators.dummy import DummyOperator
+ from airflow.operators.dummy import DummyOperator # type: ignore
Review Comment:
This is fine. We want to promote EmptyOperator usage and import Dummy as
Emptyi in import on "module not found" makes a nice fallback. We only need
falback for compatibilty but we want that anyone looking at our providers from
now on used Empty*.
The tests will fail if they don't do the fallback so we will detect it - we
can also even add a e specialized pre-commit that will look for this:
and suggest changing:
```
from airflow.operators.empty import EmptyOperator
```
into
```
try:
from airflow.operators.empty import EmptyOperator
except ModuleNotFoundError:
from airflow.operators.dummy import DummyOperator as Empty Operator
```
if import is detected without try/ except around it. That's easy check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]