bug: breaking changes in sqlglot 28.0.0
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_": https://github.com/tobymao/sqlglot/commit/adcf14fce1ee12fab28bcbcfcaed0f59ea814f0a#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
- [x] I agree to follow this project's Code of Conduct
Oof, yeah. I guess we can also fix things and require a newer version, or go the compat route, which is annoying.
I'd suggest to force sqlglot < 28.0.0 asap and not wait to solve the problem 'properly' I just lost about a whole working day to this bug and must now spend my Sunday to make up for lost time.
Re-edit: I am not complaining, you people to great work, and I love ibis, just giving my opinion on a preference and giving a reason for it.