Skip to content

bug: breaking changes in sqlglot 28.0.0 #11767

@JonAnCla

Description

@JonAnCla

What happened?

sqlglot 28.0.0 introduces breaking changes in arg names for many expression objects

The one I came across is the "except" kwarg of Star() has been renamed to "except_":
tobymao/sqlglot@adcf14f#diff-63eb8dd82d3561bc414e3e13cf59516bd6584c5766a10072157a8a5aee4ad85fR8586

Note that there are a number of others (see commit above) - basically every expression arg that overlaps with a python keyword has been renamed with an underscore suffix e.g. "from", "with" etc

Reproducer in code snippet below:

import ibis
t = ibis.table(schema={'a': 'int64', 
                       'b': 'string', 
                       'c': 'string', 
                       'd': 'int8', 
                       'e': 'string', })

expr = (
    t
    .cast({'a': '!int64', 
           'b': '!string', 
           'c': '!string', 
           'd': '!int8', 
           'e': 'string', })
    .drop('d')
)
expr.to_sql()

With sqlglot < 28.0.0 this produced:

SELECT
  "t1".*
  EXCLUDE ("d")
FROM (
  SELECT
    CAST("t0"."a" AS BIGINT) AS "a",
    CAST("t0"."b" AS TEXT) AS "b",
    CAST("t0"."c" AS TEXT) AS "c",
    CAST("t0"."d" AS TINYINT) AS "d",
    "t0"."e"
  FROM "unbound_table_0" AS "t0"
) AS "t1"

With sqlglot 28.0.0 the "EXCLUDE" is dropped

SELECT
  "t1".*
FROM (
  SELECT
    CAST("t0"."a" AS BIGINT) AS "a",
    CAST("t0"."b" AS TEXT) AS "b",
    CAST("t0"."c" AS TEXT) AS "c",
    CAST("t0"."d" AS TINYINT) AS "d",
    "t0"."e"
  FROM "unbound_table_0" AS "t0"
) AS "t1"

A pin on sqlglot<28.0.0 is needed until this is addressed in ibis I think?

Thanks!

What version of ibis are you using?

ibis 11.0.0, sqlglot 28.0.0

What backend(s) are you using, if any?

No response

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior inside of ibis

    Type

    No type

    Projects

    Status

    backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions