Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(duckdb): allow table creation from expr with geospatial datatypes #7818

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ibis/backends/base/sqlglot/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ class DuckDBType(SqlglotType):
default_decimal_scale = 3
default_interval_precision = "us"

unknown_type_strings = FrozenDict({"wkb_blob": dt.binary})

@classmethod
def _from_sqlglot_TIMESTAMP(cls) -> dt.Timestamp:
return dt.Timestamp(scale=6, nullable=cls.default_nullable)
Expand Down
13 changes: 13 additions & 0 deletions ibis/backends/duckdb/tests/test_geospatial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

from operator import methodcaller

import numpy.testing as npt
import pandas.testing as tm
import pyarrow as pa
Expand Down Expand Up @@ -210,3 +212,14 @@ def test_geospatial_convert(geotable, gdf):
gtm.assert_geoseries_equal(
geo_ll.to_pandas(), gdf_ll, check_less_precise=True, check_crs=False
)


def test_create_table_geospatial_types(geotable, con):
name = ibis.util.gen_name("geotable")

# con = ibis.get_backend(geotable)

t = con.create_table(name, geotable, temp=True)

assert t.op().name in con.list_tables()
assert any(map(methodcaller("is_geospatial"), t.schema().values()))