Skip to content

Commit

Permalink
fix(duckdb): ensure that duckdb columns argument to read_csv accepts …
Browse files Browse the repository at this point in the history
…duckdb syntax not ibis syntax
  • Loading branch information
cpcloud committed Jan 21, 2025
1 parent 671cc88 commit ba8b94a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ibis/backends/duckdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,14 +667,17 @@ def read_csv(
def make_struct_argument(obj: Mapping[str, str | dt.DataType]) -> sge.Struct:
expressions = []
geospatial = False
type_mapper = self.compiler.type_mapper
dialect = self.compiler.dialect

for name, typ in obj.items():
typ = dt.dtype(typ)
geospatial |= typ.is_geospatial()
sgtype = type_mapper.from_ibis(typ)
sgtype = sg.parse_one(typ, read=dialect, into=sge.DataType)
geospatial |= sgtype.this in (
sge.DataType.Type.GEOGRAPHY,
sge.DataType.Type.GEOMETRY,
)
prop = sge.PropertyEQ(
this=sge.to_identifier(name), expression=sge.convert(sgtype)
this=sge.to_identifier(name),
expression=sge.convert(sgtype.sql(dialect)),
)
expressions.append(prop)

Expand Down

0 comments on commit ba8b94a

Please sign in to comment.