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

Commit 0bb96fd

Browse files
fix: Address Dialect.dbapi deprecation warning by implementing import_dbapi (#14)
1 parent 50d577d commit 0bb96fd

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
strategy:
5555
matrix:
5656
python-version: ["3.8", "3.9", "3.10", "3.11"]
57-
sqlalchemy-version: ["1", "2"]
57+
sqlalchemy-version: ["1.*", "2.*"]
5858
steps:
5959
- uses: actions/checkout@v3
6060
- uses: actions/setup-python@v4

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Source = "https://github.com/edgarrmondragon/sqlean-driver"
4343
source = "vcs"
4444

4545
[tool.hatch.envs.default]
46-
dependencies = ["coverage[toml]>=6.5", "pytest", "sqlalchemy=={env:SQLALCHEMY_VERSION:1}.*"]
46+
dependencies = ["coverage[toml]>=6.5", "pytest", "sqlalchemy=={env:SQLALCHEMY_VERSION:2.*}"]
4747
[tool.hatch.envs.default.scripts]
4848
test = "pytest {args:tests}"
4949
test-cov = "coverage run -m pytest {args:tests}"

src/sqlean_driver/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ class SQLeanDialect(SQLiteDialect_pysqlite):
2424

2525
@classmethod
2626
def dbapi(cls: type[SQLeanDialect]) -> ModuleType: # type: ignore[override]
27+
"""Return the DBAPI module.
28+
29+
NOTE: This is a legacy method that will stop being used by SQLAlchemy at some point.
30+
"""
31+
return cls.import_dbapi()
32+
33+
@classmethod
34+
def import_dbapi(cls: type[SQLeanDialect]) -> ModuleType:
2735
"""Return the DBAPI module."""
2836
import sqlean
2937

0 commit comments

Comments
 (0)