Skip to content

Conversation

@karenc-bq
Copy link
Contributor

Description

The MySQLDriverDialect imports some classes there are only available if MySQL Connector/Python C Extension is available in the community driver. This is not necessarily always present on the customer's environment. In this case, the current behaviour would propagate an import error immediately and making the driver unusable.

This PR handles the case when C extension isn't available so it doesn't break customer's workflow.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@karenc-bq karenc-bq force-pushed the fix/handle-missing-cextension branch from 0ea34f6 to ac20df5 Compare November 12, 2025 23:42
from mysql.connector.cursor_cext import CMySQLCursor

try:
from mysql.connector import CMySQLConnection

Choose a reason for hiding this comment

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

I believe these are also imported in the tests/unit/test_mysql_driver_dialect.py file and tests/unit/test_mysql_driver_dialect.py file and tests/integration/container/test_blue_green_deployment.py - should those also be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unit tests are updated in a separate PR #1030 so I am intentionally leaving them out here. I will update the integration test though, good catch

@karenc-bq karenc-bq force-pushed the fix/handle-missing-cextension branch from cd2457c to bb028f9 Compare December 1, 2025 23:02
@karenc-bq karenc-bq merged commit e8b2445 into main Dec 1, 2025
7 checks passed
@karenc-bq karenc-bq deleted the fix/handle-missing-cextension branch December 1, 2025 23:02
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