Goal
DuckDBBackend.create_table(name, obj=<in-memory data>) works with sqlglot 30.18.0.
Currently, with ibis-framework 12.0.0 and sqlglot 30.18.0:
import ibis, pandas as pd
con = ibis.duckdb.connect()
con.create_table("t", obj=pd.DataFrame({"a": [1, 2]}))
# duckdb.ParserException: Parser Error: syntax error at end of input
Root cause: the in-memory branch of create_table builds
sge.Drop(kind="VIEW", this=table.get_name(), exists=True) with this as a
plain string. sqlglot 30.18.0 renders it as DROP VIEW IF EXISTS with no
view name, which duckdb rejects. sqlglot 30.17.0 still rendered the name.
The other sge.Drop calls in the same method pass sg.table(...) objects and
are unaffected, so wrapping the name (sg.to_identifier(...) or
sg.table(...)) would likely fix it.
Why
ibis-framework declares sqlglot>=23.4,!=26.32.0 with no upper bound, so
every fresh install resolves sqlglot 30.18.0 and any in-memory create_table
on duckdb fails. Downstream projects currently have to pin sqlglot<30.18 as
a workaround.
References
ibis/backends/duckdb/__init__.py (create_table, in-memory branch:
sge.Drop(kind="VIEW", this=table.get_name(), exists=True)), still present on main
- sqlglot 30.18.0 release: https://pypi.org/project/sqlglot/30.18.0/
- Versions used to reproduce: ibis-framework 12.0.0, sqlglot 30.18.0, duckdb 1.5.5, Python 3.14
Goal
DuckDBBackend.create_table(name, obj=<in-memory data>)works with sqlglot 30.18.0.Currently, with ibis-framework 12.0.0 and sqlglot 30.18.0:
Root cause: the in-memory branch of
create_tablebuildssge.Drop(kind="VIEW", this=table.get_name(), exists=True)withthisas aplain string. sqlglot 30.18.0 renders it as
DROP VIEW IF EXISTSwith noview name, which duckdb rejects. sqlglot 30.17.0 still rendered the name.
The other
sge.Dropcalls in the same method passsg.table(...)objects andare unaffected, so wrapping the name (
sg.to_identifier(...)orsg.table(...)) would likely fix it.Why
ibis-frameworkdeclaressqlglot>=23.4,!=26.32.0with no upper bound, soevery fresh install resolves sqlglot 30.18.0 and any in-memory
create_tableon duckdb fails. Downstream projects currently have to pin
sqlglot<30.18asa workaround.
References
ibis/backends/duckdb/__init__.py(create_table, in-memory branch:sge.Drop(kind="VIEW", this=table.get_name(), exists=True)), still present onmain