Skip to content

fix(providers/common/sql): add dummy connection setter for backward compatibility - #42490

Merged
phanikumv merged 1 commit into
apache:mainfrom
astronomer:add-dummy-connection-setter-to-common-sql
Sep 26, 2024
Merged

fix(providers/common/sql): add dummy connection setter for backward compatibility#42490
phanikumv merged 1 commit into
apache:mainfrom
astronomer:add-dummy-connection-setter-to-common-sql

Conversation

@Lee-W

@Lee-WLee-W commented Sep 26, 2024

Copy link
Copy Markdown
Member

Why

The introduction of connection property breaks apache-airflow-providers-mysql<5.7.1, apache-airflow-providers-elasticsearch<5.5.1 and apache-airflow-providers-postgres<5.13.0

What

Add a dummy connection setter

Closes: #42452


^ 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.

@Lee-W
Lee-W requested a review from eladkal as a code ownerSeptember 26, 2024 04:12
@phanikumvphanikumv changed the title fix(providers/common/sql): add dummpy connection setter for backward compatibilityfix(providers/common/sql): add dummy connection setter for backward compatibilitySep 26, 2024
Comment threadairflow/providers/common/sql/hooks/sql.py Outdated
Comment threadtests/providers/mysql/hooks/test_mysql.py Outdated
Comment threadairflow/providers/common/sql/hooks/sql.py Outdated
@Lee-W
Lee-Wforce-pushed the add-dummy-connection-setter-to-common-sql branch from e87f608 to 8b35d2bCompareSeptember 26, 2024 07:23

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

This stops the error, but why does it work? Were those providers never reading self.connection again?

@Lee-W

Lee-W commented Sep 26, 2024

Copy link
Copy Markdown
MemberAuthor

This stops the error, but why does it work? Were those providers never reading self.connection again?

They're reading through the newly introduced property connection (since common-sql > 1.17.0)

@ephraimbuddyephraimbuddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you patch this change on old common/sql and test with the affected mysql?

My understanding is that the connection would be read from 'get_conn' which validates this change but yeah, let's test with a patch

…compatibility
the introduction of connection property breaks apache-airflow-providers-mysql<5.7.1,
apache-airflow-providers-elasticsearch<5.5.1
and apache-airflow-providers-postgres<5.13.0
@Lee-W
Lee-Wforce-pushed the add-dummy-connection-setter-to-common-sql branch from 8b35d2b to 8e3ea21CompareSeptember 26, 2024 08:16
@dabla

dabla commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

Does the dummy setter solve this issue now? The problem is caused by my PR 40751.

@Lee-W

Copy link
Copy Markdown
MemberAuthor

Can you patch this change on old common/sql and test with the affected mysql?

My understanding is that the connection would be read from 'get_conn' which validates this change but yeah, let's test with a patch

Yep, works as expected

@dabla

Copy link
Copy Markdown
Contributor

Can you patch this change on old common/sql and test with the affected mysql?
My understanding is that the connection would be read from 'get_conn' which validates this change but yeah, let's test with a patch

Yep, works as expected

Good to hear, sorry for the caused inconvenience.

@phanikumv
phanikumv merged commit 7ad586e into apache:mainSep 26, 2024
@phanikumv
phanikumv deleted the add-dummy-connection-setter-to-common-sql branch September 26, 2024 12:39
joaopamaral pushed a commit to joaopamaral/airflow that referenced this pull request Oct 21, 2024
…ompatibility (apache#42490)
the introduction of connection property breaks apache-airflow-providers-mysql<5.7.1,
apache-airflow-providers-elasticsearch<5.5.1
and apache-airflow-providers-postgres<5.13.0
ellisms pushed a commit to ellisms/airflow that referenced this pull request Nov 13, 2024
…ompatibility (apache#42490)
the introduction of connection property breaks apache-airflow-providers-mysql<5.7.1,
apache-airflow-providers-elasticsearch<5.5.1
and apache-airflow-providers-postgres<5.13.0
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MySqlHook constructor fails with exception after upgrading apache-airflow-providers-common-sql from 1.16.0 to 1.17.0

7 participants

@Lee-W@dabla@ashb@uranusjr@ephraimbuddy@sunank200@phanikumv