Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong MRO in operators without __init__ #41085

Closed
2 tasks done
grihabor opened this issue Jul 28, 2024 · 2 comments · Fixed by #41086
Closed
2 tasks done

Wrong MRO in operators without __init__ #41085

grihabor opened this issue Jul 28, 2024 · 2 comments · Fixed by #41086
Assignees
Labels

Comments

@grihabor
Copy link
Contributor

Apache Airflow version

2.9.3

If "Other Airflow 2 version" selected, which one?

No response

What happened?

Wrong MRO leads to an exception when subclassing BaseSQLOperator and BranchSQLOperator, see below

What you think should happen instead?

No response

How to reproduce

from airflow.providers.common.sql.operators import sql

class Mixin(sql.BaseSQLOperator):
    pass

class Branch(Mixin, sql.BranchSQLOperator):
    pass

Branch(task_id='test', conn_id='abc', follow_task_ids_if_true='x', follow_task_ids_if_false='y')

Output:

AirflowException: Invalid arguments were passed to Branch (task_id: test). Invalid arguments were:
**kwargs: {'follow_task_ids_if_true': 'x', 'follow_task_ids_if_false': 'y'}

Operating System

Ubuntu 22.04

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@grihabor grihabor added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Jul 28, 2024
Copy link

boring-cyborg bot commented Jul 28, 2024

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

@grihabor grihabor changed the title Wrong MRO order in operators without __init__ Wrong MRO in operators without __init__ Jul 28, 2024
@Lee-W
Copy link
Member

Lee-W commented Jul 30, 2024

Thanks for filing this issue. I just verified this can be reproduced in the latest main (a7b0dc2)

@Lee-W Lee-W removed the needs-triage label for new issues that we didn't triage yet label Jul 30, 2024
pankajastro added a commit to astronomer/astronomer-cosmos that referenced this issue Aug 20, 2024
We have a few classes that lack an `__init__` method, and their parent
class is BaseOperator. These classes are failing to load due to changes
introduced in the PR: apache/airflow#41085.

I'm adding `__init__` at missing places in this PR and also adding
Airflow 2.10 in our test matrix

CI:
https://github.com/astronomer/astronomer-cosmos/actions/runs/10469548488


closes: #1166
closes: #1165
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants