Skip to content

Commit 20e4fa7

Browse files
committed
🐛 import MySQLConnectionAbstract instead of concrete implementations
1 parent 0095622 commit 20e4fa7

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

mysql_to_sqlite3/transporter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
import mysql.connector
1515
import typing_extensions as tx
16-
from mysql.connector import MySQLConnection, errorcode
17-
from mysql.connector.connection_cext import CMySQLConnection
16+
from mysql.connector import errorcode
17+
from mysql.connector.abstracts import MySQLConnectionAbstract
1818
from mysql.connector.types import ToPythonOutputTypes
1919
from tqdm import tqdm, trange
2020

@@ -124,7 +124,7 @@ def __init__(self, **kwargs: tx.Unpack[MySQLtoSQLiteParams]) -> None:
124124
port=self._mysql_port,
125125
ssl_disabled=self._mysql_ssl_disabled,
126126
)
127-
if isinstance(_mysql_connection, (MySQLConnection, CMySQLConnection)):
127+
if isinstance(_mysql_connection, MySQLConnectionAbstract):
128128
self._mysql = _mysql_connection
129129
else:
130130
raise ConnectionError("Unable to connect to MySQL")

mysql_to_sqlite3/types.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from sqlite3 import Connection, Cursor
66

77
import typing_extensions as tx
8-
from mysql.connector import MySQLConnection
9-
from mysql.connector.connection_cext import CMySQLConnection
8+
from mysql.connector.abstracts import MySQLConnectionAbstract
109
from mysql.connector.cursor import MySQLCursorDict, MySQLCursorPrepared, MySQLCursorRaw
1110

1211

@@ -46,7 +45,7 @@ class MySQLtoSQLiteAttributes:
4645
_json_as_text: bool
4746
_limit_rows: int
4847
_logger: Logger
49-
_mysql: t.Union[MySQLConnection, CMySQLConnection]
48+
_mysql: MySQLConnectionAbstract
5049
_mysql_cur: MySQLCursorRaw
5150
_mysql_cur_dict: MySQLCursorDict
5251
_mysql_cur_prepared: MySQLCursorPrepared

0 commit comments

Comments
 (0)