From a4918be0c1d81387a7da77f47619248496129351 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 26 May 2024 18:32:25 -0400 Subject: [PATCH] fix(deps): update dependency sqlglot to v24 (#9229) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com> --- .../backends/clickhouse/tests/test_datatypes.py | 17 +++++++++++++++++ ibis/backends/mysql/compiler.py | 4 +++- ibis/backends/postgres/compiler.py | 4 +++- poetry.lock | 13 ++++++++----- pyproject.toml | 2 +- requirements-dev.txt | 2 +- 6 files changed, 33 insertions(+), 9 deletions(-) diff --git a/ibis/backends/clickhouse/tests/test_datatypes.py b/ibis/backends/clickhouse/tests/test_datatypes.py index b784ceb224ef..103f32aa64d6 100644 --- a/ibis/backends/clickhouse/tests/test_datatypes.py +++ b/ibis/backends/clickhouse/tests/test_datatypes.py @@ -3,7 +3,9 @@ import hypothesis as h import hypothesis.strategies as st import pytest +import sqlglot as sg import sqlglot.expressions as sge +from packaging.version import parse as vparse from pytest import param import ibis @@ -192,6 +194,11 @@ def test_array_discovery_clickhouse(con): ), nullable=False, ), + marks=pytest.mark.xfail( + vparse(sg.__version__) == vparse("24.0.0"), + reason="struct parsing for clickhouse broken in sqlglot 24", + raises=sg.ParseError, + ), id="named_tuple", ), param( @@ -203,6 +210,11 @@ def test_array_discovery_clickhouse(con): ), nullable=False, ), + marks=pytest.mark.xfail( + vparse("24.0.0") <= vparse(sg.__version__) <= vparse("24.0.1"), + reason="struct parsing for clickhouse broken in sqlglot 24", + raises=sg.ParseError, + ), id="unnamed_tuple", ), param( @@ -214,6 +226,11 @@ def test_array_discovery_clickhouse(con): ), nullable=False, ), + marks=pytest.mark.xfail( + vparse("24.0.0") <= vparse(sg.__version__) <= vparse("24.0.1"), + reason="struct parsing for clickhouse broken in sqlglot 24", + raises=sg.ParseError, + ), id="partially_named", ), param( diff --git a/ibis/backends/mysql/compiler.py b/ibis/backends/mysql/compiler.py index 02040fd636f4..66e791266c63 100644 --- a/ibis/backends/mysql/compiler.py +++ b/ibis/backends/mysql/compiler.py @@ -276,7 +276,9 @@ def visit_StringFind(self, op, *, arg, substr, start, end): def visit_LRStrip(self, op, *, arg, position): return reduce( - lambda arg, char: self.f.trim(this=arg, position=position, expression=char), + lambda arg, char: self.f.trim( + this=arg, position=self.v[position], expression=char + ), map( partial(self.cast, to=dt.string), map(self.f.unhex, map(self.f.hex, string.whitespace.encode())), diff --git a/ibis/backends/postgres/compiler.py b/ibis/backends/postgres/compiler.py index e4d843dd0c8b..2e74f380ffc9 100644 --- a/ibis/backends/postgres/compiler.py +++ b/ibis/backends/postgres/compiler.py @@ -225,7 +225,9 @@ def visit_ArrayConcat(self, op, *, arg): def visit_ArrayContains(self, op, *, arg, other): arg_dtype = op.arg.dtype - return sge.ArrayContains( + # ArrayContainsAll introduced in 24, keep backcompat if it doesn't exist + cls = getattr(sge, "ArrayContainsAll", sge.ArrayContains) + return cls( this=self.cast(arg, arg_dtype), expression=self.f.array(self.cast(other, arg_dtype.value_type)), ) diff --git a/poetry.lock b/poetry.lock index a2fce4ac3e2e..faa157f16196 100644 --- a/poetry.lock +++ b/poetry.lock @@ -4966,6 +4966,8 @@ files = [ {file = "psycopg2-2.9.9-cp310-cp310-win_amd64.whl", hash = "sha256:426f9f29bde126913a20a96ff8ce7d73fd8a216cfb323b1f04da402d452853c3"}, {file = "psycopg2-2.9.9-cp311-cp311-win32.whl", hash = "sha256:ade01303ccf7ae12c356a5e10911c9e1c51136003a9a1d92f7aa9d010fb98372"}, {file = "psycopg2-2.9.9-cp311-cp311-win_amd64.whl", hash = "sha256:121081ea2e76729acfb0673ff33755e8703d45e926e416cb59bae3a86c6a4981"}, + {file = "psycopg2-2.9.9-cp312-cp312-win32.whl", hash = "sha256:d735786acc7dd25815e89cc4ad529a43af779db2e25aa7c626de864127e5a024"}, + {file = "psycopg2-2.9.9-cp312-cp312-win_amd64.whl", hash = "sha256:a7653d00b732afb6fc597e29c50ad28087dcb4fbfb28e86092277a559ae4e693"}, {file = "psycopg2-2.9.9-cp37-cp37m-win32.whl", hash = "sha256:5e0d98cade4f0e0304d7d6f25bbfbc5bd186e07b38eac65379309c4ca3193efa"}, {file = "psycopg2-2.9.9-cp37-cp37m-win_amd64.whl", hash = "sha256:7e2dacf8b009a1c1e843b5213a87f7c544b2b042476ed7755be813eaf4e8347a"}, {file = "psycopg2-2.9.9-cp38-cp38-win32.whl", hash = "sha256:ff432630e510709564c01dafdbe996cb552e0b9f3f065eb89bdce5bd31fabf4c"}, @@ -6009,6 +6011,7 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -7061,17 +7064,17 @@ sqlcipher = ["sqlcipher3_binary"] [[package]] name = "sqlglot" -version = "23.17.0" +version = "24.0.1" description = "An easily customizable SQL parser and transpiler" optional = false python-versions = ">=3.7" files = [ - {file = "sqlglot-23.17.0-py3-none-any.whl", hash = "sha256:ecd860f4a8278600c537755bcbd60b1a63ef6a0dc33dfb16170ea428422749de"}, - {file = "sqlglot-23.17.0.tar.gz", hash = "sha256:8e5786f26b0b337921cabc32d1222238c9e56f34560e1ac65a9b36178f9bb9e4"}, + {file = "sqlglot-24.0.1-py3-none-any.whl", hash = "sha256:2b0e26e1adb50d5c6719260672e871e75a21675fc829b1045dd9d744fe970963"}, + {file = "sqlglot-24.0.1.tar.gz", hash = "sha256:ff97297eb4e87525e057735f743c4fb15bf680891eca329037acdd147a508dd5"}, ] [package.extras] -dev = ["duckdb (>=0.6)", "maturin (>=1.4,<2.0)", "mypy", "pandas", "pandas-stubs", "pdoc", "pre-commit", "pyspark", "python-dateutil", "ruff (==0.4.3)", "types-python-dateutil", "typing-extensions"] +dev = ["duckdb (>=0.6)", "maturin (>=1.4,<2.0)", "mypy", "pandas", "pandas-stubs", "pdoc", "pre-commit", "python-dateutil", "ruff (==0.4.3)", "types-python-dateutil", "typing-extensions"] rs = ["sqlglotrs (==0.2.5)"] [[package]] @@ -8072,4 +8075,4 @@ visualization = ["graphviz"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "f3f052012be7a8ccb418350d33b767cc3e4b62640a0584b38b1873a6eaedc16a" +content-hash = "9f1e8fa7f1b73d5ac4ab883f892300ae19d5e057bcb0fbe53fa85fa52ab237b4" diff --git a/pyproject.toml b/pyproject.toml index 11e8315af031..1a849c877733 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ pyarrow-hotfix = ">=0.4,<1" python-dateutil = ">=2.8.2,<3" pytz = ">=2022.7" rich = ">=12.4.4,<14" -sqlglot = ">=23.4,<23.18" +sqlglot = ">=23.4,<24.1" toolz = ">=0.11,<1" typing-extensions = ">=4.3.0,<5" black = { version = ">=22.1.0,<25", optional = true } diff --git a/requirements-dev.txt b/requirements-dev.txt index 3618647941d7..0c0f2a2ef037 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -275,7 +275,7 @@ sortedcontainers==2.4.0 ; python_version >= "3.10" and python_version < "4.0" soupsieve==2.5 ; python_version >= "3.10" and python_version < "3.13" sphobjinv==2.3.1 ; python_version >= "3.10" and python_version < "3.13" sqlalchemy==2.0.30 ; python_version >= "3.10" and python_version < "3.13" -sqlglot==23.17.0 ; python_version >= "3.10" and python_version < "4.0" +sqlglot==24.0.1 ; python_version >= "3.10" and python_version < "4.0" stack-data==0.6.3 ; python_version >= "3.10" and python_version < "4.0" statsmodels==0.14.2 ; python_version >= "3.10" and python_version < "3.13" stdlib-list==0.10.0 ; python_version >= "3.10" and python_version < "4.0"