Skip to content

Commit ac19c46

Browse files
authored
fix: build issues for mysql (#335)
* fix: pin mysql-connector-python version and update classifiers in pyproject.toml * fix: update Arrow type assertions in integration tests to use pandas type checking functions
1 parent eb27d52 commit ac19c46

File tree

10 files changed

+81
-34
lines changed

10 files changed

+81
-34
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ upgrade: ## Upgrade all dependencies
7878
@echo "${OK} Dependencies updated 🔄"
7979
@uv run pre-commit autoupdate
8080
@echo "${OK} Updated Pre-commit hooks 🔄"
81+
@uv lock >/dev/null 2>&1
82+
@echo ""
83+
@echo "${WARN} mysql-connector-python is pinned via [tool.uv] exclude-newer-package in pyproject.toml"
84+
@echo "${INFO} Check https://pypi.org/project/mysql-connector-python/#files for Python 3.12+ wheels."
85+
@echo "${INFO} Once Oracle fixes their packaging, remove the constraint from pyproject.toml."
8186

8287
.PHONY: lock
8388
lock: ## Rebuild lockfiles from scratch

pyproject.toml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
[project]
22
authors = [{ name = "Cody Fincher", email = "cody@litestar.dev" }]
3+
classifiers = [
4+
"Development Status :: 5 - Production/Stable",
5+
"Programming Language :: Python :: 3",
6+
"Programming Language :: Python :: 3.10",
7+
"Programming Language :: Python :: 3.11",
8+
"Programming Language :: Python :: 3.12",
9+
"Programming Language :: Python :: 3.13",
10+
"Programming Language :: Python :: 3.14",
11+
"Programming Language :: Python :: 3 :: Only",
12+
"Typing :: Typed",
13+
]
314
dependencies = [
415
"typing-extensions",
516
"sqlglot>=19.9.0",
@@ -14,17 +25,6 @@ name = "sqlspec"
1425
readme = "README.md"
1526
requires-python = ">=3.10, <4.0"
1627
version = "0.38.1"
17-
classifiers = [
18-
"Development Status :: 5 - Production/Stable",
19-
"Programming Language :: Python :: 3",
20-
"Programming Language :: Python :: 3.10",
21-
"Programming Language :: Python :: 3.11",
22-
"Programming Language :: Python :: 3.12",
23-
"Programming Language :: Python :: 3.13",
24-
"Programming Language :: Python :: 3.14",
25-
"Programming Language :: Python :: 3 :: Only",
26-
"Typing :: Typed",
27-
]
2828

2929
[project.urls]
3030
Discord = "https://discord.gg/litestar"
@@ -148,6 +148,12 @@ test = [
148148
"pytest-timeout>=2.3.1",
149149
]
150150

151+
[tool.uv]
152+
# NOTE: mysql-connector-python 9.6.0 (released 2026-01-21) removed Python 3.12+ wheels.
153+
# This is an Oracle packaging bug. Pinning to versions before that date until fixed.
154+
# Check https://pypi.org/project/mysql-connector-python/#files for updates.
155+
exclude-newer-package = { mysql-connector-python = "2026-01-20" }
156+
151157
[project.scripts]
152158
sqlspec = "sqlspec.__main__:run_cli"
153159

tests/integration/adapters/aiosqlite/test_arrow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,10 @@ async def test_select_to_arrow_type_preservation(aiosqlite_arrow_config: Aiosqli
200200
result = await session.select_to_arrow("SELECT * FROM arrow_types_test ORDER BY id")
201201

202202
df = result.to_pandas()
203+
from pandas.api.types import is_string_dtype
204+
203205
assert len(df) == 2
204-
assert df["name"].dtype == object
206+
assert is_string_dtype(df["name"])
205207
# SQLite INTEGER (for booleans) comes through as int64
206208
assert df["is_active"].dtype in (int, "int64", "Int64")
207209
finally:

tests/integration/adapters/asyncmy/test_arrow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,10 @@ async def test_select_to_arrow_type_preservation(asyncmy_driver: AsyncmyDriver)
173173
result = await asyncmy_driver.select_to_arrow("SELECT * FROM arrow_types_test ORDER BY id")
174174

175175
df = result.to_pandas()
176+
from pandas.api.types import is_string_dtype
177+
176178
assert len(df) == 2
177-
assert df["name"].dtype == object
179+
assert is_string_dtype(df["name"])
178180
assert df["is_active"].dtype in (bool, int, "int64", "Int64")
179181

180182
await asyncmy_driver.execute("DROP TABLE IF EXISTS arrow_types_test")

tests/integration/adapters/asyncpg/test_arrow.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,11 @@ async def test_select_to_arrow_type_preservation(asyncpg_async_driver: AsyncpgDr
179179
result = await asyncpg_async_driver.select_to_arrow("SELECT * FROM arrow_types_test ORDER BY id")
180180

181181
df = result.to_pandas()
182+
from pandas.api.types import is_bool_dtype, is_string_dtype
183+
182184
assert len(df) == 2
183-
assert df["name"].dtype == object
184-
assert df["is_active"].dtype == bool
185+
assert is_string_dtype(df["name"])
186+
assert is_bool_dtype(df["is_active"])
185187

186188
await asyncpg_async_driver.execute("DROP TABLE IF EXISTS arrow_types_test CASCADE")
187189

tests/integration/adapters/duckdb/test_arrow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,11 @@ def test_select_to_arrow_type_preservation(duckdb_basic_session: "DuckDBDriver")
184184
result = driver.select_to_arrow("SELECT * FROM arrow_types_test ORDER BY id")
185185

186186
df = result.to_pandas()
187+
from pandas.api.types import is_string_dtype
188+
187189
assert len(df) == 2
188190
assert df["id"].dtype == "int32"
189-
assert df["name"].dtype == "object"
191+
assert is_string_dtype(df["name"])
190192
assert df["price"].dtype == "float64"
191193
assert df["active"].dtype == "bool"
192194
finally:

tests/integration/adapters/oracledb/test_arrow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,10 @@ async def test_select_to_arrow_type_preservation(oracle_async_session: "OracleAs
232232
result = await driver.select_to_arrow("SELECT * FROM arrow_types_test ORDER BY id")
233233

234234
df = result.to_pandas()
235+
from pandas.api.types import is_string_dtype
236+
235237
assert len(df) == 2
236-
assert df["name"].dtype == object
238+
assert is_string_dtype(df["name"])
237239
assert set(df["is_active"].unique()) <= {0, 1}
238240
finally:
239241
await _safe_drop_table(driver, "arrow_types_test")

tests/integration/adapters/psqlpy/test_arrow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ async def test_select_to_arrow_type_preservation(psqlpy_driver: "PsqlpyDriver")
165165
"""Test that PostgreSQL types map correctly to Arrow."""
166166

167167
driver = psqlpy_driver
168+
await driver.execute("DROP TABLE IF EXISTS arrow_types_test CASCADE")
168169
await driver.execute(
169170
"""
170171
CREATE TABLE arrow_types_test (

tests/integration/adapters/psycopg/test_arrow.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@ async def test_select_to_arrow_type_preservation(psycopg_config: PsycopgAsyncCon
171171
result = await session.select_to_arrow("SELECT * FROM arrow_types_test ORDER BY id")
172172

173173
df = result.to_pandas()
174+
from pandas.api.types import is_bool_dtype, is_string_dtype
175+
174176
assert len(df) == 2
175-
assert df["name"].dtype == object
176-
assert df["is_active"].dtype == bool
177+
assert is_string_dtype(df["name"])
178+
assert is_bool_dtype(df["is_active"])
177179

178180

179181
async def test_select_to_arrow_postgres_array(psycopg_config: PsycopgAsyncConfig) -> None:

uv.lock

Lines changed: 38 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)