Skip to content

Commit

Permalink
Fix for SQLAlchemy 1
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Sep 11, 2023
1 parent edaa6b1 commit 1e3be42
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions samples/sample_custom_sql_adapter/connector.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from __future__ import annotations

import typing as t

from sqlalchemy.engine.default import DefaultDialect

if t.TYPE_CHECKING:
from types import ModuleType


class CustomSQLDialect(DefaultDialect):
"""Custom SQLite dialect that supports JSON."""
Expand All @@ -17,3 +22,11 @@ def import_dbapi(cls):
import sqlite3

return sqlite3

@classmethod
def dbapi(cls) -> ModuleType: # type: ignore[override]
"""Return the DBAPI module.
NOTE: This is a legacy method that will stop being used by SQLAlchemy at some point.
""" # noqa: E501
return cls.import_dbapi()

0 comments on commit 1e3be42

Please sign in to comment.