Skip to content

Add fallback to standard provider import in example_dms - #73193

Merged
vincbeck merged 1 commit into
apache:mainfrom
aws-mwaa:vincbeck/airflow2_sys_test_dms
Sep 16, 2026
Merged

vincbeck merged 1 commit into
apache:mainfrom
aws-mwaa:vincbeck/airflow2_sys_test_dms

Conversation

@vincbeck

Copy link
Copy Markdown
Contributor

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@vincbeck
vincbeck requested a review from o-nikolas as a code owner September 15, 2026 13:16
@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Sep 15, 2026
Comment thread providers/amazon/tests/system/amazon/aws/example_dms.py
kaxil
kaxil previously requested changes Sep 15, 2026

@kaxil kaxil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just requesting changes to know more on "the why"

@vincbeck

Copy link
Copy Markdown
Contributor Author

The standard provider was not introduced in Airflow 3?

@kaxil

kaxil commented Sep 15, 2026

Copy link
Copy Markdown
Member

The standard provider was not introduced in Airflow 3?

The standard provider actually predates Airflow 3 :) It landed in #41564 in Sep 2024 and was first released as 0.0.1 in Nov 2024 with apache-airflow>=2.8.0, and we CI-tested it against 2.8/2.9 in #43556.

Today providers/standard requires apache-airflow>=2.11.0, which is the same floor providers/amazon has, so I don't think there's a supported combination where amazon works but standard isn't installable (amazon also already lists it as an extra). And the fallback target airflow.sensors.date_time is the old pre-move location, so the except branch would only kick in on Airflow <= 2.7, which is below our floor.

That said, did you hit an actual ImportError somewhere? If the standard provider just isn't installed in the environment where you saw this?

@kaxil
kaxil dismissed their stale review September 15, 2026 15:20

Standard provider should work for Airflow >=2.8

@vincbeck

vincbeck commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor Author

That said, did you hit an actual ImportError somewhere? If the standard provider just isn't installed in the environment where you saw this?

Exactly, basically we are running our system tests against Airflow 2.11, see dashboard here: https://aws-mwaa.github.io/#/open-source/system-tests/version/2.11.0.html. We want to make sure operators and sensors in the amazon provider package are still working in Airflow 2.11. In this setup, the standard provider is not installed, we could, but we rather do it without it to be more strict about it. That's why I need to add this fallback. The error I am getting is:


==================================== ERRORS ====================================
--
___ ERROR collecting providers/amazon/tests/system/amazon/aws/example_dms.py ___
ImportError while importing test module '/opt/airflow/providers/amazon/tests/system/amazon/aws/example_dms.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/python/lib/python3.12/importlib/__init__.py:90: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
providers/amazon/tests/system/amazon/aws/example_dms.py:48: in <module>
from airflow.providers.standard.sensors.date_time import DateTimeSensorAsync
E   ModuleNotFoundError: No module named 'airflow.providers.standard'
----------- generated xml file: /files/test_result-none-postgres.xml -----------
=========================== short test summary info ============================
ERROR providers/amazon/tests/system/amazon/aws/example_dms.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
========================= 1 warning, 1 error in 6.75s ==========================

Let me know if you have further question

@vincbeck

Copy link
Copy Markdown
Contributor Author

And the fallback target airflow.sensors.date_time is the old pre-move location, so the except branch would only kick in on Airflow <= 2.7, which is below our floor.

This is the part I'd push back on — airflow.sensors.date_time is still live in 2.11, not just a pre-2.8 location. In the 2.11.0 tag, airflow/sensors/date_time.py natively defines both DateTimeSensor (line 32) and DateTimeSensorAsync (line 81): full implementations, no re-export from the standard provider, no deprecation shim, no warning. The move out of core only completed in Airflow 3, so core kept these modules for the whole 2.x line. That means the except branch resolves fine on 2.11 — it's the branch my run above actually takes.

On "installable": providers/amazon lists the standard provider as an optional extra rather than a dependency, so amazon-on-2.11 without standard installed is a supported combination, not a broken one. That's the combination we're deliberately exercising, to catch anything in the amazon provider that quietly leans on standard.

Worth noting this pattern is already established in the amazon system tests — three files use the identical try / except ImportError for BashOperator, down to the same comment:

  • providers/amazon/tests/system/amazon/aws/example_appflow.py:30
  • providers/amazon/tests/system/amazon/aws/example_http_to_s3.py:24
  • providers/amazon/tests/system/amazon/aws/utils/k8s.py:21

airflow.operators.bash is equally live in 2.11 core, so those three fall under the same reasoning as this change. This PR is bringing example_dms in line with them rather than introducing something new.

@vincbeck
vincbeck merged commit db09830 into apache:main Sep 16, 2026
83 checks passed
@vincbeck
vincbeck deleted the vincbeck/airflow2_sys_test_dms branch September 16, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants