Skip to content

bug(duckdb): create_table with in-memory data fails with sqlglot>=30.18 (nameless DROP VIEW) #12124

Description

@amol-

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions