Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit a52b243

Browse files
Adjust for SQLAlchemy 1
1 parent 3a322a0 commit a52b243

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ skip-string-normalization = true
110110
ignore = [
111111
"ANN101", # missing-type-self
112112
"ANN102", # missing-type-cls
113+
"FIX002", # line-contains-todo
113114
]
114115
line-length = 100
115116
select = [

src/sqlean_driver/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class SQLeanDialect(SQLiteDialect_pysqlite):
8484

8585
driver = "sqlean"
8686
supports_statement_cache = True
87-
type_compiler_cls = SQLeanTypeCompiler
87+
type_compiler = SQLeanTypeCompiler
8888

8989
@classmethod
9090
def dbapi(cls) -> ModuleType: # type: ignore[override]

src/sqlean_driver/custom_types.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ def result_processor(
7171
"""Return a result processor."""
7272
return none_or_ip_interface
7373

74+
# TODO(edgarrmondragon): Add missing type parameters:
75+
# > sqltypes.Indexable.Comparator[IPAddress]
76+
# > sqltypes.Concatenable.Comparator[IPAddress]
77+
# https://github.com/edgarrmondragon/sqlean-driver/issues/37
7478
class Comparator(
75-
sqltypes.Indexable.Comparator[IPAddress],
76-
sqltypes.Concatenable.Comparator[IPAddress],
79+
sqltypes.Indexable.Comparator, # type: ignore[type-arg]
80+
sqltypes.Concatenable.Comparator, # type: ignore[type-arg]
7781
):
7882
"""Comparator for the INET type."""
7983

tests/test_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_ipaddr_types(
8787
"""Test that the types work."""
8888
engine = create_engine("sqlite+sqlean:///:memory:?extensions=ipaddr")
8989
metadata.create_all(engine)
90-
with engine.connect() as conn:
90+
with engine.connect() as conn, conn.begin():
9191
conn.execute(table.insert(), data)
9292
result = conn.execute(query)
9393
assert result.fetchone() == expected
@@ -112,7 +112,7 @@ def test_uuid_types(
112112
"""Test that the types work."""
113113
engine = create_engine("sqlite+sqlean:///:memory:?extensions=uuid")
114114
metadata.create_all(engine)
115-
with engine.connect() as conn:
115+
with engine.connect() as conn, conn.begin():
116116
conn.execute(table.insert(), data)
117117
result = conn.execute(query)
118118
assert result.fetchone() == expected

0 commit comments

Comments
 (0)