Skip to content

Commit

Permalink
limit mysql-connector-python<9.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyu-meng-mxy committed Aug 28, 2024
1 parent cd22920 commit 28ef334
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion mysql_mimic/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Default: ...
"character_set_database": (str, CharacterSet.utf8mb4.name, True),
"character_set_results": (str, CharacterSet.utf8mb4.name, True),
"character_set_server": (str, CharacterSet.utf8mb4.name, True),
"collation_connection": (str, Collation.utf8mb4_0900_ai_ci.name, True),
"collation_connection": (str, Collation.utf8mb4_general_ci.name, True),
"collation_database": (str, Collation.utf8mb4_general_ci.name, True),
"collation_server": (str, Collation.utf8mb4_general_ci.name, True),
"external_user": (str, "", False),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dev": [
"aiomysql",
"mypy",
"mysql-connector-python",
"mysql-connector-python<9.0.0",
"black",
"coverage",
"freezegun",
Expand Down
11 changes: 3 additions & 8 deletions tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ async def q3(sql: str) -> Sequence[Dict[str, Any]]:

async def q4(sql: str) -> Sequence[Dict[str, Any]]:
async with sqlalchemy_engine.connect() as conn:
# Sqlglot by-default runs `SET NAMES 'utf8mb4'` if no charset specified, which removes COLLATE settings
# See https://github.com/sqlalchemy/sqlalchemy/discussions/7858
await conn.execute(
text("SET NAMES 'utf8mb4' COLLATE 'utf8mb4_0900_ai_ci'")
)
cursor = await conn.execute(text(sql))
if cursor.returns_rows:
return cursor.mappings().all() # type: ignore
Expand Down Expand Up @@ -409,7 +404,7 @@ async def test_query_attributes(
"@@character_set_client": "utf8mb4",
"@@SESSION.character_set_connection": "utf8mb4",
"@@character_set_results": "utf8mb4",
"@@collation_connection": "utf8mb4_0900_ai_ci",
"@@collation_connection": "utf8mb4_general_ci",
}
],
),
Expand Down Expand Up @@ -658,7 +653,7 @@ async def test_query_attributes(
{"Value": "utf8mb4", "Variable_name": "character_set_results"},
{"Value": "utf8mb4", "Variable_name": "character_set_server"},
{
"Value": "utf8mb4_0900_ai_ci",
"Value": "utf8mb4_general_ci",
"Variable_name": "collation_connection",
},
{"Value": "utf8mb4_general_ci", "Variable_name": "collation_database"},
Expand Down Expand Up @@ -756,7 +751,7 @@ async def test_query_attributes(
"character_set_connection": "utf8mb4",
"character_set_results": "utf8mb4",
"character_set_server": "utf8mb4",
"collation_connection": "utf8mb4_0900_ai_ci",
"collation_connection": "utf8mb4_general_ci",
"collation_server": "utf8mb4_general_ci",
"init_connect": "",
"interactive_timeout": 28800,
Expand Down

0 comments on commit 28ef334

Please sign in to comment.