Skip to content

SqsMessageQueueProvider deprecation mechanism causes circular import #51770

@uranusjr

Description

@uranusjr

Body

>>> from airflow.providers.amazon.aws.queues.sqs import SqsMessageQueueProvider
/opt/airflow/airflow-core/src/airflow/configuration.py:812 DeprecationWarning: The grid_view_sorting_order option in [webserver] has been moved to the grid_view_sorting_order option in [api] - the old setting has been used, but please update your config.
/opt/airflow/airflow-core/src/airflow/configuration.py:813 DeprecationWarning: The grid_view_sorting_order option in [webserver] has been moved to the grid_view_sorting_order option in [api] - the old setting has been used, but please update your config.
[2025-06-16T05:12:30.562+0000] {providers_manager.py:275} WARNING - Exception when importing 'airflow.providers.amazon.aws.queues.sqs.SqsMessageQueueProvider' from 'apache-airflow-providers-amazon' package
Traceback (most recent call last):
  File "/opt/airflow/airflow-core/src/airflow/utils/module_loading.py", line 63, in import_string
    return getattr(module, class_name)
AttributeError: partially initialized module 'airflow.providers.amazon.aws.queues.sqs' has no attribute 'SqsMessageQueueProvider' (most likely due to a circular import)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/airflow/airflow-core/src/airflow/providers_manager.py", line 306, in _correctness_check
    imported_class = import_string(class_name)
  File "/opt/airflow/airflow-core/src/airflow/utils/module_loading.py", line 65, in import_string
    raise ImportError(f'Module "{module_path}" does not define a "{class_name}" attribute/class')
ImportError: Module "airflow.providers.amazon.aws.queues.sqs" does not define a "SqsMessageQueueProvider" attribute/class

This is because SqsMessageQueueProvider imports BaseMessageQueueProvider from airflow.providers.common.messaging.providers.base_provider, but importing that module triggers importing airflow.providers.common.messaging.providers, which wants to import SqsMessageQueueProvider so it can be added as a deprecated class. Circulr dependency.

I am not sure how to resolve this. Leaving it for now, maybe @potiuk you know what to do.

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:providerskind:bugThis is a clearly a bugkind:metaHigh-level information important to the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions