Skip to content

Commit 645631f

Browse files
committed
🔖 release v2.1.9
1 parent fd6781d commit 645631f

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 2.1.9
2+
3+
* [FIX] pin MySQL Connector/Python to 8.3.0
4+
15
# 2.1.8
26

37
* [FIX] ensure index names do not collide with table names

mysql_to_sqlite3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Utility to transfer data from MySQL to SQLite 3."""
2-
__version__ = "2.1.8"
2+
__version__ = "2.1.9"
33

44
from .transporter import MySQLtoSQLite

mysql_to_sqlite3/transporter.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import typing_extensions as tx
1616
from mysql.connector import errorcode
1717
from mysql.connector.abstracts import MySQLConnectionAbstract
18-
from mysql.connector.types import ToPythonOutputTypes
18+
from mysql.connector.types import RowItemType
1919
from tqdm import tqdm, trange
2020

2121
from mysql_to_sqlite3.mysql_utils import CHARSET_INTRODUCERS
@@ -252,9 +252,9 @@ def _translate_type_from_mysql_to_sqlite(
252252
@classmethod
253253
def _translate_default_from_mysql_to_sqlite(
254254
cls,
255-
column_default: ToPythonOutputTypes = None,
255+
column_default: RowItemType = None,
256256
column_type: t.Optional[str] = None,
257-
column_extra: ToPythonOutputTypes = None,
257+
column_extra: RowItemType = None,
258258
) -> str:
259259
is_binary: bool
260260
is_hex: bool
@@ -405,7 +405,7 @@ def _build_create_table_sql(self, table_name: str) -> str:
405405
""",
406406
(self._mysql_database, table_name),
407407
)
408-
mysql_indices: t.Sequence[t.Optional[t.Dict[str, ToPythonOutputTypes]]] = self._mysql_cur_dict.fetchall()
408+
mysql_indices: t.Sequence[t.Optional[t.Dict[str, RowItemType]]] = self._mysql_cur_dict.fetchall()
409409
for index in mysql_indices:
410410
if index is not None:
411411
index_name: str
@@ -426,7 +426,7 @@ def _build_create_table_sql(self, table_name: str) -> str:
426426
""",
427427
(self._mysql_database, index_name),
428428
)
429-
collision: t.Optional[t.Dict[str, ToPythonOutputTypes]] = self._mysql_cur_dict.fetchone()
429+
collision: t.Optional[t.Dict[str, RowItemType]] = self._mysql_cur_dict.fetchone()
430430
table_collisions: int = 0
431431
if collision is not None:
432432
table_collisions = int(collision["count"]) # type: ignore[arg-type]
@@ -456,7 +456,7 @@ def _build_create_table_sql(self, table_name: str) -> str:
456456
sql = sql.rstrip(", ")
457457

458458
if not self._without_foreign_keys:
459-
server_version: t.Tuple[int, ...] = self._mysql.get_server_version()
459+
server_version: t.Optional[t.Tuple[int, ...]] = self._mysql.get_server_version()
460460
self._mysql_cur_dict.execute(
461461
"""
462462
SELECT k.COLUMN_NAME AS `column`,
@@ -481,7 +481,9 @@ def _build_create_table_sql(self, table_name: str) -> str:
481481
c.UPDATE_RULE,
482482
c.DELETE_RULE
483483
""".format(
484-
JOIN="JOIN" if (server_version[0] == 8 and server_version[2] > 19) else "LEFT JOIN"
484+
JOIN="JOIN"
485+
if (server_version is not None and server_version[0] == 8 and server_version[2] > 19)
486+
else "LEFT JOIN"
485487
),
486488
(self._mysql_database, table_name, "FOREIGN KEY"),
487489
)
@@ -602,7 +604,7 @@ def transfer(self) -> None:
602604
),
603605
specific_tables,
604606
)
605-
tables: t.Iterable[ToPythonOutputTypes] = (row[0] for row in self._mysql_cur_prepared.fetchall())
607+
tables: t.Iterable[RowItemType] = (row[0] for row in self._mysql_cur_prepared.fetchall())
606608
else:
607609
# transfer all tables
608610
self._mysql_cur.execute(
@@ -646,7 +648,7 @@ def transfer(self) -> None:
646648
# get all rows
647649
self._mysql_cur_dict.execute(f"SELECT COUNT(*) AS `total_records` FROM `{table_name}`")
648650

649-
total_records: t.Optional[t.Dict[str, ToPythonOutputTypes]] = self._mysql_cur_dict.fetchone()
651+
total_records: t.Optional[t.Dict[str, RowItemType]] = self._mysql_cur_dict.fetchone()
650652
if total_records is not None:
651653
total_records_count: int = int(total_records["total_records"]) # type: ignore[arg-type]
652654
else:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ classifiers = [
3939
]
4040
dependencies = [
4141
"Click>=8.1.3",
42-
"mysql-connector-python>=8.2.0",
42+
"mysql-connector-python==8.3.0",
4343
"pytimeparse2",
4444
"python-slugify>=7.0.0",
4545
"simplejson>=3.19.0",

0 commit comments

Comments
 (0)