Skip to content

Suppress JException when get_autocommit and set_autocommit methods aren't supported on JDBC driver - #43786

Merged
potiuk merged 17 commits into
apache:mainfrom
dabla:fix/also-suppress-jexception-in-jdbc-hook-when-unsupported
Nov 28, 2024
Merged

Suppress JException when get_autocommit and set_autocommit methods aren't supported on JDBC driver#43786
potiuk merged 17 commits into
apache:mainfrom
dabla:fix/also-suppress-jexception-in-jdbc-hook-when-unsupported

Conversation

@dabla

@dabla dabla commented Nov 7, 2024

Copy link
Copy Markdown
Contributor

Today we experienced that when the get_autocommit or the set_autocommit methods aren't supported on the SAS Jdbc driver,
we get an jpype.JException instead of an jaydebeapi.Error, so I added it to the suppressed exceptions. Unfortunately, I wasn't able to add a specific test case for that exception, as I was unable to mock the JException without the need of a JVM running, which we don't want.


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

…eptions if those operations aren't supported by the JDBC driver
@dabla
dabla marked this pull request as draft November 8, 2024 11:44
@dabla
dabla marked this pull request as ready for review November 8, 2024 11:59
Comment thread providers/src/airflow/providers/jdbc/provider.yaml

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

Approved with small nit about version update

Comment thread providers/src/airflow/providers/jdbc/provider.yaml
@eladkal eladkal changed the title Also suppress JException when get_autocommit and set_autocommit methods aren't supported on Jdbc driver Suppress JException when get_autocommit and set_autocommit methods aren't supported on JDBC driver Nov 12, 2024
@potiuk
potiuk merged commit b32ca97 into apache:main Nov 28, 2024
prabhusneha pushed a commit to astronomer/airflow that referenced this pull request Nov 28, 2024
…en't supported on JDBC driver (apache#43786)

* refactor: get_autocommit and set_autocommit should also suppress JExceptions if those operations aren't supported by the JDBC driver

* refactor: Use the cached connection property instead of get_connection in sqlalchemy_url and get_conn methods

* refactor: Bumped version of jdbc provider to 4.5.3

* Update providers/src/airflow/providers/jdbc/provider.yaml

---------

Co-authored-by: David Blain <david.blain@infrabel.be>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
got686-yandex pushed a commit to got686-yandex/airflow that referenced this pull request Jan 30, 2025
…en't supported on JDBC driver (apache#43786)

* refactor: get_autocommit and set_autocommit should also suppress JExceptions if those operations aren't supported by the JDBC driver

* refactor: Use the cached connection property instead of get_connection in sqlalchemy_url and get_conn methods

* refactor: Bumped version of jdbc provider to 4.5.3

* Update providers/src/airflow/providers/jdbc/provider.yaml

---------

Co-authored-by: David Blain <david.blain@infrabel.be>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Sign up for free to 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.

3 participants