Skip to content

Migrate to Airflow 3.x compatible imports#69

Open
mrhallak wants to merge 2 commits intomasterfrom
feature/airflow-3-compatibility
Open

Migrate to Airflow 3.x compatible imports#69
mrhallak wants to merge 2 commits intomasterfrom
feature/airflow-3-compatibility

Conversation

@mrhallak
Copy link
Copy Markdown

@mrhallak mrhallak commented Apr 15, 2026

Summary

  • Replace all deprecated Airflow 2.x import paths with Airflow 3.x equivalents
  • Remove @apply_defaults decorator (automatic in Airflow 3)
  • Remove provide_context=True parameter (always provided in Airflow 3)
  • Replace execution_date with logical_date (with fallback for compatibility)
  • Replace airflow.contrib.* with airflow.providers.*
  • Replace DummyOperator with EmptyOperator
  • Rename schedule_interval to schedule in DAG constructor

Files changed (18)

Category Files
DummyOperator -> EmptyOperator operator_factory.py, dummy_creator.py
PythonOperator import path python_creator.py, operator_factories.py
schedule_interval -> schedule dag_creator.py
airflow.contrib -> providers aws_glue_job_operator.py, snowflake_operator.py, slack_alerts.py
base_hook -> base sqoop_hook.py, slack_alerts.py
airflow.www removed redshift_sql_operator.py
@apply_defaults removed 7 operator files
provide_context removed python_creator.py, operator_factories.py, airflow_op_creator.py
execution_date -> logical_date dag_creator.py, slack_alerts.py, alert.py

Related PRs

  • chocoapp/dataeng-airflow#243 — Main Airflow 3.2.0 upgrade
  • chocoapp/dataeng-airflow-dags#11022 — DAGs repo compatibility fixes

Test plan

  • Install in Airflow 3.2.0 environment and verify DAG loading
  • Verified on datatst - all DAGs loading successfully

Breaking import changes:
- DummyOperator -> EmptyOperator (airflow.operators.empty)
- PythonOperator/ShortCircuitOperator -> airflow.operators.python
- airflow.contrib.hooks.aws_hook.AwsHook -> providers.amazon AwsBaseHook
- airflow.contrib.hooks.snowflake_hook -> providers.snowflake
- airflow.contrib.operators.slack_webhook_operator -> providers.slack
- airflow.hooks.base_hook -> airflow.hooks.base
- airflow.www.utils removed (used in redshift_sql_operator)

Removed deprecated patterns:
- @apply_defaults decorator (automatic in Airflow 3)
- provide_context=True parameter (always provided in Airflow 3)

Renamed context variables:
- execution_date -> logical_date (with fallback for compatibility)
@mrhallak mrhallak marked this pull request as ready for review April 16, 2026 10:29
@mrhallak mrhallak requested a review from a team as a code owner April 16, 2026 10:29
template_fields = ('query', 'database', 'output_location')
template_ext = ('.sql', )

@apply_defaults
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we don't need to decorate with apply_defaults aymore?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants