Skip to content

Commit

Permalink
refactor(sqlite): port to SQLGlot (#8154)
Browse files Browse the repository at this point in the history
Port the SQLite backend to sqlglot

Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
  • Loading branch information
2 people authored and kszucs committed Feb 12, 2024
1 parent 09fb2e8 commit 4d24502
Show file tree
Hide file tree
Showing 30 changed files with 1,378 additions and 1,883 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ibis-backends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ jobs:
title: Pandas
extras:
- pandas
# - name: sqlite
# title: SQLite
# extras:
# - sqlite
- name: sqlite
title: SQLite
extras:
- sqlite
- name: datafusion
title: Datafusion
extras:
Expand Down
20 changes: 20 additions & 0 deletions ibis/backends/base/sqlglot/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,26 @@ def _from_ibis_Struct(cls, dtype: dt.Struct) -> sge.DataType:
class SQLiteType(SqlglotType):
dialect = "sqlite"

@classmethod
def _from_sqlglot_INT(cls) -> dt.Int64:
return dt.Int64(nullable=cls.default_nullable)

@classmethod
def _from_sqlglot_FLOAT(cls) -> dt.Float64:
return dt.Float64(nullable=cls.default_nullable)

@classmethod
def _from_ibis_Array(cls, dtype: dt.Array) -> NoReturn:
raise com.UnsupportedBackendType("Array types aren't supported in SQLite")

@classmethod
def _from_ibis_Map(cls, dtype: dt.Map) -> NoReturn:
raise com.UnsupportedBackendType("Map types aren't supported in SQLite")

@classmethod
def _from_ibis_Struct(cls, dtype: dt.Struct) -> sge.DataType:
raise com.UnsupportedBackendType("Struct types aren't supported in SQLite")


class ImpalaType(SqlglotType):
dialect = "impala"
Expand Down
5 changes: 2 additions & 3 deletions ibis/backends/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,20 +570,19 @@ def ddl_con(ddl_backend):
params=_get_backends_to_test(
keep=(
"risingwave",
"sqlite",
)
),
scope="session",
)
def alchemy_backend(request, data_dir, tmp_path_factory, worker_id):
"""Set up the SQLAlchemy-based backends."""
return _setup_backend(request, data_dir, tmp_path_factory, worker_id)
pytest.skip("No SQLAlchemy backends remaining")


@pytest.fixture(scope="session")
def alchemy_con(alchemy_backend):
"""Instance of Client, already connected to the db (if applies)."""
return alchemy_backend.connection
pytest.skip("No SQLAlchemy backends remaining")


@pytest.fixture(
Expand Down
Loading

0 comments on commit 4d24502

Please sign in to comment.