CClarke
CClarke

Reputation: 576

How do I import Airflow operators for version 2.2.5?

I have just upgraded my Airflow to 2.2.5 and I can't use the EmptyOperator. It should be simple from airflow.operators.empty import EmptyOperatorbut I get the error ModuleNotFoundError: No module named 'airflow.operators.empty'. I also tried:

from airflow.operators import empty
from empty.operators import EmptyOperator

The Airflow repo itself shows the structure that would mean from airflow.operators.empty import EmptyOperator should work but it doesn't so I am really puzzled as to what is going on.

Upvotes: 3

Views: 5063

Answers (1)

Elad Kalif
Elad Kalif

Reputation: 15921

EmptyOperator was released in Airflow 2.3.0.

In Airflow 2.3.0 DummyOperator was deprecated in favor of EmptyOperator (See PR)

For Airflow>=2.3.0 you should use EmptyOperator:

from airflow.operators.empty import EmptyOperator

For Airflow<2.3.0 you should use DummyOperator:

from airflow.operators.dummy import DummyOperator

Upvotes: 10

Related Questions