Skip to content

Commit

Permalink
fix: support MySQL v9 (#713)
Browse files Browse the repository at this point in the history
  • Loading branch information
karenc-bq authored Oct 18, 2024
1 parent 7946565 commit d702496
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions aws_advanced_python_wrapper/mysql_driver_dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,18 @@ def get_connection_from_obj(self, obj: object) -> Any:

if isinstance(obj, CMySQLCursor):
try:
if isinstance(obj._cnx, CMySQLConnection) or isinstance(obj._cnx, MySQLConnection):
return obj._cnx
conn = None

if hasattr(obj, '_cnx'):
conn = obj._cnx
elif hasattr(obj, '_connection'):
conn = obj._connection
if conn is None:
return None

if isinstance(conn, CMySQLConnection) or isinstance(conn, MySQLConnection):
return conn

except ReferenceError:
return None

Expand Down

0 comments on commit d702496

Please sign in to comment.