Skip to content

Import the right BaseOperator in baseoperatorlinks - #46895

Merged
ashb merged 1 commit into
apache:mainfrom
amoghrajesh:fixingCI
Feb 19, 2025
Merged

ashb merged 1 commit into
apache:mainfrom
amoghrajesh:fixingCI

Conversation

@amoghrajesh

Copy link
Copy Markdown
Contributor

Ran into this issue on my PR:

providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/synapse.py:156: error:
Argument 1 of "get_link" is incompatible with supertype "BaseOperatorLink";
supertype defines the argument type as "BaseOperator"  [override]
        def get_link(self, operator: BaseOperator, *, ti_key: TaskInstance...
                           ^~~~~~~~~~~~~~~~~~~~~~
providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/synapse.py:156: note: This violates the Liskov substitution principle
providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/synapse.py:156: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/powerbi.py:[40](https://github.com/apache/airflow/actions/runs/13411555655/job/37463344676?pr=46860#step:6:41): error:
Argument 1 of "get_link" is incompatible with supertype "BaseOperatorLink";
supertype defines the argument type as "BaseOperator"  [override]
        def get_link(self, operator: BaseOperator, *, ti_key: TaskInstance...

Caused due to recent change: #46415

Changing back to the correct BaseOperator from models. We will make the move when we start moving providers to use task sdk cc @ashb


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@ashb ashb 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.

I guess if this fixes it that's fine for now, but I don't think this is the "best" long term fix

@amoghrajesh

Copy link
Copy Markdown
Contributor Author

Definitely not. But we should start making this change once we start moving providers to use task sdk imports. That way providers will not have a airflow.models import

@ashb

ashb commented Feb 19, 2025

Copy link
Copy Markdown
Member

This isn't running mypy-providers so I'm merging this now anyway

@ashb
ashb merged commit f0abca1 into apache:main Feb 19, 2025
ntr pushed a commit to ntr/airflow that referenced this pull request Feb 20, 2025
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.

3 participants