sqlglot 26.25.3__tar.gz → 26.27.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sqlglot-26.25.3 → sqlglot-26.27.1}/CHANGELOG.md +52 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/PKG-INFO +2 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/README.md +1 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/_version.py +2 -2
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/bigquery.py +10 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/clickhouse.py +1 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/hive.py +1 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/mysql.py +25 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/postgres.py +23 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/risingwave.py +4 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/snowflake.py +11 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/spark.py +1 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/sqlite.py +11 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/starrocks.py +16 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/expressions.py +50 -17
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/generator.py +5 -3
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/parser.py +205 -64
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/transforms.py +87 -78
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot.egg-info/PKG-INFO +2 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/src/token.rs +23 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_bigquery.py +1 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_dialect.py +209 -14
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_duckdb.py +20 -7
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_hive.py +11 -3
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_mysql.py +14 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_postgres.py +24 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_presto.py +1 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_snowflake.py +50 -6
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_spark.py +2 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_sqlite.py +7 -2
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_starrocks.py +3 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_tsql.py +1 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/identity.sql +3 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_expressions.py +12 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_parser.py +6 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_tokens.py +7 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_transforms.py +38 -1
- {sqlglot-26.25.3 → sqlglot-26.27.1}/.gitignore +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/.gitpod.yml +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/.pre-commit-config.yaml +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/CONTRIBUTING.md +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/LICENSE +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/MANIFEST.in +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/Makefile +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/pyproject.toml +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/setup.cfg +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/setup.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/__init__.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/__main__.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/_typing.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/__init__.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/athena.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/databricks.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/dialect.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/doris.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/drill.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/druid.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/duckdb.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/dune.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/materialize.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/oracle.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/presto.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/prql.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/redshift.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/spark2.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/tableau.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/teradata.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/trino.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/dialects/tsql.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/diff.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/errors.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/executor/__init__.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/executor/context.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/executor/env.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/executor/python.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/executor/table.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/helper.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/jsonpath.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/lineage.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/__init__.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/annotate_types.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/canonicalize.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/eliminate_ctes.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/eliminate_joins.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/eliminate_subqueries.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/isolate_table_selects.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/merge_subqueries.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/normalize.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/normalize_identifiers.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/optimize_joins.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/optimizer.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/pushdown_predicates.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/pushdown_projections.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/qualify.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/qualify_columns.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/qualify_tables.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/scope.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/simplify.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/optimizer/unnest_subqueries.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/planner.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/py.typed +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/schema.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/serde.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/time.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/tokens.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot/trie.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot.egg-info/SOURCES.txt +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot.egg-info/dependency_links.txt +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot.egg-info/requires.txt +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot.egg-info/top_level.txt +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglot.png +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/Cargo.lock +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/Cargo.toml +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/benches/dialect_settings.json +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/benches/long.rs +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/benches/token_type_settings.json +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/benches/tokenizer_dialect_settings.json +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/benches/tokenizer_settings.json +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/pyproject.toml +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/src/lib.rs +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/src/settings.rs +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/src/tokenizer.rs +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/sqlglotrs/src/trie.rs +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/__init__.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/__init__.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_athena.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_clickhouse.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_databricks.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_doris.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_drill.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_druid.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_dune.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_materialize.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_oracle.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_prql.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_redshift.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_risingwave.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_tableau.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_teradata.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/dialects/test_trino.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/jsonpath/LICENSE +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/jsonpath/cts.json +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/annotate_functions.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/annotate_types.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/canonicalize.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/eliminate_ctes.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/eliminate_joins.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/eliminate_subqueries.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/isolate_table_selects.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/merge_subqueries.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/normalize.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/normalize_identifiers.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/optimize_joins.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/optimizer.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/pushdown_cte_alias_columns.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/pushdown_predicates.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/pushdown_projections.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/qualify_columns.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/qualify_columns__invalid.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/qualify_columns__with_invisible.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/qualify_columns_ddl.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/qualify_tables.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/quote_identifiers.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/simplify.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/call_center.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/catalog_page.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/catalog_returns.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/catalog_sales.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/customer.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/customer_address.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/customer_demographics.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/date_dim.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/household_demographics.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/income_band.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/inventory.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/item.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/promotion.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/reason.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/ship_mode.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/store.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/store_returns.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/store_sales.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/time_dim.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/tpc-ds.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/warehouse.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/web_page.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/web_returns.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/web_sales.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-ds/web_site.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-h/customer.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-h/lineitem.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-h/nation.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-h/orders.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-h/part.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-h/partsupp.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-h/region.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-h/supplier.csv.gz +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/tpc-h/tpc-h.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/optimizer/unnest_subqueries.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/partial.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/fixtures/pretty.sql +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/gen_fixtures.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/helpers.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_build.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_diff.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_docs.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_executor.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_generator.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_helper.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_jsonpath.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_lineage.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_optimizer.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_schema.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_serde.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_time.py +0 -0
- {sqlglot-26.25.3 → sqlglot-26.27.1}/tests/test_transpile.py +0 -0
@@ -1,6 +1,56 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## [v26.26.0] - 2025-06-09
|
5
|
+
### :boom: BREAKING CHANGES
|
6
|
+
- due to [`434c45b`](https://github.com/tobymao/sqlglot/commit/434c45b547c3a5ea155dc8d7da2baab326eb6d4f) - improve support for ENDSWITH closes [#5170](https://github.com/tobymao/sqlglot/pull/5170) *(commit by [@georgesittas](https://github.com/georgesittas))*:
|
7
|
+
|
8
|
+
improve support for ENDSWITH closes #5170
|
9
|
+
|
10
|
+
- due to [`bc001ce`](https://github.com/tobymao/sqlglot/commit/bc001cef4c907d8fa421d3190b4fa91865d9ff6c) - Add support for ANY_VALUE for versions 16+ *(PR [#5179](https://github.com/tobymao/sqlglot/pull/5179) by [@VaggelisD](https://github.com/VaggelisD))*:
|
11
|
+
|
12
|
+
Add support for ANY_VALUE for versions 16+ (#5179)
|
13
|
+
|
14
|
+
- due to [`6a2cb39`](https://github.com/tobymao/sqlglot/commit/6a2cb39d0ceec091dc4fc228f26d4f457729a3cf) - virtual column with AS(expr) as ComputedColumnConstraint *(PR [#5180](https://github.com/tobymao/sqlglot/pull/5180) by [@geooo109](https://github.com/geooo109))*:
|
15
|
+
|
16
|
+
virtual column with AS(expr) as ComputedColumnConstraint (#5180)
|
17
|
+
|
18
|
+
- due to [`29e2f1d`](https://github.com/tobymao/sqlglot/commit/29e2f1d89c095c9fab0944a6962c99bd745c2c91) - Array_intersection transpilation support *(PR [#5186](https://github.com/tobymao/sqlglot/pull/5186) by [@HarishRavi96](https://github.com/HarishRavi96))*:
|
19
|
+
|
20
|
+
Array_intersection transpilation support (#5186)
|
21
|
+
|
22
|
+
|
23
|
+
### :sparkles: New Features
|
24
|
+
- [`434c45b`](https://github.com/tobymao/sqlglot/commit/434c45b547c3a5ea155dc8d7da2baab326eb6d4f) - improve support for ENDSWITH closes [#5170](https://github.com/tobymao/sqlglot/pull/5170) *(commit by [@georgesittas](https://github.com/georgesittas))*
|
25
|
+
- [`63f9cb4`](https://github.com/tobymao/sqlglot/commit/63f9cb4b158b88574136b32241ee60254352c9e6) - **sqlglotrs**: match the Python implementation of __repr__ for tokens *(PR [#5172](https://github.com/tobymao/sqlglot/pull/5172) by [@georgesittas](https://github.com/georgesittas))*
|
26
|
+
- [`c007afa`](https://github.com/tobymao/sqlglot/commit/c007afa23831e9bd86f401d85260e15edf00328f) - support Star instance as first arg of exp.column helper *(PR [#5177](https://github.com/tobymao/sqlglot/pull/5177) by [@georgesittas](https://github.com/georgesittas))*
|
27
|
+
- [`bc001ce`](https://github.com/tobymao/sqlglot/commit/bc001cef4c907d8fa421d3190b4fa91865d9ff6c) - **postgres**: Add support for ANY_VALUE for versions 16+ *(PR [#5179](https://github.com/tobymao/sqlglot/pull/5179) by [@VaggelisD](https://github.com/VaggelisD))*
|
28
|
+
- :arrow_lower_right: *addresses issue [#4674](https://github.com/TobikoData/sqlmesh/issues/4674) opened by [@petrikoro](https://github.com/petrikoro)*
|
29
|
+
- [`ba05ff6`](https://github.com/tobymao/sqlglot/commit/ba05ff67127e056d567fc2c1d3bcc8e3dcce7b7e) - **parser**: AGGREGATE with GROUP AND ORDER BY pipe syntax *(PR [#5171](https://github.com/tobymao/sqlglot/pull/5171) by [@geooo109](https://github.com/geooo109))*
|
30
|
+
- [`26077a4`](https://github.com/tobymao/sqlglot/commit/26077a47d9db750f44ab1baf9a434596b5bb613b) - make to_table more lenient *(PR [#5183](https://github.com/tobymao/sqlglot/pull/5183) by [@georgesittas](https://github.com/georgesittas))*
|
31
|
+
- [`29e2f1d`](https://github.com/tobymao/sqlglot/commit/29e2f1d89c095c9fab0944a6962c99bd745c2c91) - Array_intersection transpilation support *(PR [#5186](https://github.com/tobymao/sqlglot/pull/5186) by [@HarishRavi96](https://github.com/HarishRavi96))*
|
32
|
+
- [`d86a114`](https://github.com/tobymao/sqlglot/commit/d86a1147aeb866ed0ab2c342914ecf8cbfadac8a) - **sqlite**: implement RESPECT/IGNORE NULLS in first_value() *(PR [#5185](https://github.com/tobymao/sqlglot/pull/5185) by [@NickCrews](https://github.com/NickCrews))*
|
33
|
+
- [`1d50fca`](https://github.com/tobymao/sqlglot/commit/1d50fca8ffc34e4acbc1b791c4cdf5f184a748db) - improve transpilation of st_point and st_distance *(PR [#5194](https://github.com/tobymao/sqlglot/pull/5194) by [@georgesittas](https://github.com/georgesittas))*
|
34
|
+
- [`756ec3b`](https://github.com/tobymao/sqlglot/commit/756ec3b65db1eb2572d017a3ac12ece6bb44c726) - **parser**: SET OPERATORS with pipe syntax *(PR [#5184](https://github.com/tobymao/sqlglot/pull/5184) by [@geooo109](https://github.com/geooo109))*
|
35
|
+
|
36
|
+
### :bug: Bug Fixes
|
37
|
+
- [`6a2cb39`](https://github.com/tobymao/sqlglot/commit/6a2cb39d0ceec091dc4fc228f26d4f457729a3cf) - **parser**: virtual column with AS(expr) as ComputedColumnConstraint *(PR [#5180](https://github.com/tobymao/sqlglot/pull/5180) by [@geooo109](https://github.com/geooo109))*
|
38
|
+
- :arrow_lower_right: *fixes issue [#5173](https://github.com/tobymao/sqlglot/issues/5173) opened by [@suyah](https://github.com/suyah)*
|
39
|
+
- [`c87ae02`](https://github.com/tobymao/sqlglot/commit/c87ae02aa263be8463ca7283ebd090385a4bfd59) - **sqlite**: Add REPLACE to command tokens *(PR [#5192](https://github.com/tobymao/sqlglot/pull/5192) by [@VaggelisD](https://github.com/VaggelisD))*
|
40
|
+
- :arrow_lower_right: *fixes issue [#5187](https://github.com/tobymao/sqlglot/issues/5187) opened by [@stefanmalanik](https://github.com/stefanmalanik)*
|
41
|
+
- [`4b89afd`](https://github.com/tobymao/sqlglot/commit/4b89afdcc0063e70cbc64165c7f1f5102afaa87c) - **starrocks**: array_agg_transpilation_fix *(PR [#5190](https://github.com/tobymao/sqlglot/pull/5190) by [@Swathiraj23](https://github.com/Swathiraj23))*
|
42
|
+
- [`461b054`](https://github.com/tobymao/sqlglot/commit/461b0548832ab8d916c3a6638f27a49f681109fe) - **postgres**: support use_spheroid argument in ST_DISTANCE *(commit by [@georgesittas](https://github.com/georgesittas))*
|
43
|
+
|
44
|
+
### :wrench: Chores
|
45
|
+
- [`83de4e1`](https://github.com/tobymao/sqlglot/commit/83de4e11bc1547aa22b275b20c0326dfbe43b2b8) - improve benchmark result displaying *(PR [#5176](https://github.com/tobymao/sqlglot/pull/5176) by [@georgesittas](https://github.com/georgesittas))*
|
46
|
+
- [`5d5dc2f`](https://github.com/tobymao/sqlglot/commit/5d5dc2fa471bd53730e03ac8039804221949f843) - Clean up exp.ArrayIntersect PR *(PR [#5193](https://github.com/tobymao/sqlglot/pull/5193) by [@VaggelisD](https://github.com/VaggelisD))*
|
47
|
+
|
48
|
+
|
49
|
+
## [v26.25.3] - 2025-06-04
|
50
|
+
### :sparkles: New Features
|
51
|
+
- [`964b4a1`](https://github.com/tobymao/sqlglot/commit/964b4a1e367e00e243b80edf677cd48d453ed31e) - add line/col position for Star *(commit by [@georgesittas](https://github.com/georgesittas))*
|
52
|
+
|
53
|
+
|
4
54
|
## [v26.25.2] - 2025-06-04
|
5
55
|
### :sparkles: New Features
|
6
56
|
- [`8b5129f`](https://github.com/tobymao/sqlglot/commit/8b5129f288880032f0bf9d649984d82314039af1) - **postgres**: improve pretty-formatting of ARRAY[...] *(commit by [@georgesittas](https://github.com/georgesittas))*
|
@@ -4788,3 +4838,5 @@ Changelog
|
|
4788
4838
|
[v26.25.0]: https://github.com/tobymao/sqlglot/compare/v26.24.0...v26.25.0
|
4789
4839
|
[v26.25.1]: https://github.com/tobymao/sqlglot/compare/v26.25.0...v26.25.1
|
4790
4840
|
[v26.25.2]: https://github.com/tobymao/sqlglot/compare/v26.25.1...v26.25.2
|
4841
|
+
[v26.25.3]: https://github.com/tobymao/sqlglot/compare/v26.25.2...v26.25.3
|
4842
|
+
[v26.26.0]: https://github.com/tobymao/sqlglot/compare/v26.25.3...v26.26.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: sqlglot
|
3
|
-
Version: 26.
|
3
|
+
Version: 26.27.1
|
4
4
|
Summary: An easily customizable SQL parser and transpiler
|
5
5
|
Author-email: Toby Mao <toby.mao@gmail.com>
|
6
6
|
License: MIT License
|
@@ -558,6 +558,7 @@ See also: [Writing a Python SQL engine from scratch](https://github.com/tobymao/
|
|
558
558
|
* [Dagster](https://github.com/dagster-io/dagster)
|
559
559
|
* [Fugue](https://github.com/fugue-project/fugue)
|
560
560
|
* [Ibis](https://github.com/ibis-project/ibis)
|
561
|
+
* [dlt](https://github.com/dlt-hub/dlt)
|
561
562
|
* [mysql-mimic](https://github.com/kelsin/mysql-mimic)
|
562
563
|
* [Querybook](https://github.com/pinterest/querybook)
|
563
564
|
* [Quokka](https://github.com/marsupialtail/quokka)
|
@@ -497,6 +497,7 @@ See also: [Writing a Python SQL engine from scratch](https://github.com/tobymao/
|
|
497
497
|
* [Dagster](https://github.com/dagster-io/dagster)
|
498
498
|
* [Fugue](https://github.com/fugue-project/fugue)
|
499
499
|
* [Ibis](https://github.com/ibis-project/ibis)
|
500
|
+
* [dlt](https://github.com/dlt-hub/dlt)
|
500
501
|
* [mysql-mimic](https://github.com/kelsin/mysql-mimic)
|
501
502
|
* [Querybook](https://github.com/pinterest/querybook)
|
502
503
|
* [Quokka](https://github.com/marsupialtail/quokka)
|
@@ -525,6 +525,16 @@ class BigQuery(Dialect):
|
|
525
525
|
LOG_DEFAULTS_TO_LN = True
|
526
526
|
SUPPORTS_IMPLICIT_UNNEST = True
|
527
527
|
|
528
|
+
# BigQuery does not allow ASC/DESC to be used as an identifier
|
529
|
+
ID_VAR_TOKENS = parser.Parser.ID_VAR_TOKENS - {TokenType.ASC, TokenType.DESC}
|
530
|
+
ALIAS_TOKENS = parser.Parser.ALIAS_TOKENS - {TokenType.ASC, TokenType.DESC}
|
531
|
+
TABLE_ALIAS_TOKENS = parser.Parser.TABLE_ALIAS_TOKENS - {TokenType.ASC, TokenType.DESC}
|
532
|
+
COMMENT_TABLE_ALIAS_TOKENS = parser.Parser.COMMENT_TABLE_ALIAS_TOKENS - {
|
533
|
+
TokenType.ASC,
|
534
|
+
TokenType.DESC,
|
535
|
+
}
|
536
|
+
UPDATE_ALIAS_TOKENS = parser.Parser.UPDATE_ALIAS_TOKENS - {TokenType.ASC, TokenType.DESC}
|
537
|
+
|
528
538
|
FUNCTIONS = {
|
529
539
|
**parser.Parser.FUNCTIONS,
|
530
540
|
"CONTAINS_SUBSTR": _build_contains_substring,
|
@@ -1096,6 +1096,7 @@ class ClickHouse(Dialect):
|
|
1096
1096
|
exp.RegexpLike: lambda self, e: self.func("match", e.this, e.expression),
|
1097
1097
|
exp.Rand: rename_func("randCanonical"),
|
1098
1098
|
exp.StartsWith: rename_func("startsWith"),
|
1099
|
+
exp.EndsWith: rename_func("endsWith"),
|
1099
1100
|
exp.StrPosition: lambda self, e: strposition_sql(
|
1100
1101
|
self,
|
1101
1102
|
e,
|
@@ -557,6 +557,7 @@ class Hive(Dialect):
|
|
557
557
|
exp.GenerateDateArray: sequence_sql,
|
558
558
|
exp.If: if_sql(),
|
559
559
|
exp.ILike: no_ilike_sql,
|
560
|
+
exp.IntDiv: lambda self, e: self.binary(e, "DIV"),
|
560
561
|
exp.IsNan: rename_func("ISNAN"),
|
561
562
|
exp.JSONExtract: lambda self, e: self.func("GET_JSON_OBJECT", e.this, e.expression),
|
562
563
|
exp.JSONExtractScalar: lambda self, e: self.func(
|
@@ -489,6 +489,27 @@ class MySQL(Dialect):
|
|
489
489
|
VALUES_FOLLOWED_BY_PAREN = False
|
490
490
|
SUPPORTS_PARTITION_SELECTION = True
|
491
491
|
|
492
|
+
def _parse_generated_as_identity(
|
493
|
+
self,
|
494
|
+
) -> (
|
495
|
+
exp.GeneratedAsIdentityColumnConstraint
|
496
|
+
| exp.ComputedColumnConstraint
|
497
|
+
| exp.GeneratedAsRowColumnConstraint
|
498
|
+
):
|
499
|
+
this = super()._parse_generated_as_identity()
|
500
|
+
|
501
|
+
if self._match_texts(("STORED", "VIRTUAL")):
|
502
|
+
persisted = self._prev.text.upper() == "STORED"
|
503
|
+
|
504
|
+
if isinstance(this, exp.ComputedColumnConstraint):
|
505
|
+
this.set("persisted", persisted)
|
506
|
+
elif isinstance(this, exp.GeneratedAsIdentityColumnConstraint):
|
507
|
+
this = self.expression(
|
508
|
+
exp.ComputedColumnConstraint, this=this.expression, persisted=persisted
|
509
|
+
)
|
510
|
+
|
511
|
+
return this
|
512
|
+
|
492
513
|
def _parse_primary_key_part(self) -> t.Optional[exp.Expression]:
|
493
514
|
this = self._parse_id_var()
|
494
515
|
if not self._match(TokenType.L_PAREN):
|
@@ -1154,6 +1175,10 @@ class MySQL(Dialect):
|
|
1154
1175
|
"zerofill",
|
1155
1176
|
}
|
1156
1177
|
|
1178
|
+
def computedcolumnconstraint_sql(self, expression: exp.ComputedColumnConstraint) -> str:
|
1179
|
+
persisted = "STORED" if expression.args.get("persisted") else "VIRTUAL"
|
1180
|
+
return f"GENERATED ALWAYS AS ({self.sql(expression.this.unnest())}) {persisted}"
|
1181
|
+
|
1157
1182
|
def array_sql(self, expression: exp.Array) -> str:
|
1158
1183
|
self.unsupported("Arrays are not supported by MySQL")
|
1159
1184
|
return self.function_fallback_sql(expression)
|
@@ -36,6 +36,7 @@ from sqlglot.dialects.dialect import (
|
|
36
36
|
strposition_sql,
|
37
37
|
count_if_to_sum,
|
38
38
|
groupconcat_sql,
|
39
|
+
Version,
|
39
40
|
)
|
40
41
|
from sqlglot.generator import unsupported_args
|
41
42
|
from sqlglot.helper import is_int, seq_get
|
@@ -255,6 +256,15 @@ def _levenshtein_sql(self: Postgres.Generator, expression: exp.Levenshtein) -> s
|
|
255
256
|
return rename_func(name)(self, expression)
|
256
257
|
|
257
258
|
|
259
|
+
def _versioned_anyvalue_sql(self: Postgres.Generator, expression: exp.AnyValue) -> str:
|
260
|
+
# https://www.postgresql.org/docs/16/functions-aggregate.html
|
261
|
+
# https://www.postgresql.org/about/featurematrix/
|
262
|
+
if self.dialect.version < Version("16.0"):
|
263
|
+
return any_value_to_max_sql(self, expression)
|
264
|
+
|
265
|
+
return rename_func("ANY_VALUE")(self, expression)
|
266
|
+
|
267
|
+
|
258
268
|
class Postgres(Dialect):
|
259
269
|
INDEX_OFFSET = 1
|
260
270
|
TYPED_DIVISION = True
|
@@ -502,6 +512,18 @@ class Postgres(Dialect):
|
|
502
512
|
|
503
513
|
return this
|
504
514
|
|
515
|
+
def _parse_user_defined_type(
|
516
|
+
self, identifier: exp.Identifier
|
517
|
+
) -> t.Optional[exp.Expression]:
|
518
|
+
udt_type: exp.Identifier | exp.Dot = identifier
|
519
|
+
|
520
|
+
while self._match(TokenType.DOT):
|
521
|
+
part = self._parse_id_var()
|
522
|
+
if part:
|
523
|
+
udt_type = exp.Dot(this=udt_type, expression=part)
|
524
|
+
|
525
|
+
return exp.DataType.build(udt_type, udt=True)
|
526
|
+
|
505
527
|
class Generator(generator.Generator):
|
506
528
|
SINGLE_STRING_INTERVAL = True
|
507
529
|
RENAME_TABLE_WITH_DB = False
|
@@ -546,7 +568,7 @@ class Postgres(Dialect):
|
|
546
568
|
|
547
569
|
TRANSFORMS = {
|
548
570
|
**generator.Generator.TRANSFORMS,
|
549
|
-
exp.AnyValue:
|
571
|
+
exp.AnyValue: _versioned_anyvalue_sql,
|
550
572
|
exp.ArrayConcat: lambda self, e: self.arrayconcat_sql(e, name="ARRAY_CAT"),
|
551
573
|
exp.ArrayFilter: filter_array_using_unnest,
|
552
574
|
exp.BitwiseXor: lambda self, e: self.binary(e, "#"),
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from sqlglot.dialects.postgres import Postgres
|
3
|
+
from sqlglot.generator import Generator
|
3
4
|
from sqlglot.tokens import TokenType
|
4
5
|
import typing as t
|
5
6
|
|
@@ -72,3 +73,6 @@ class RisingWave(Postgres):
|
|
72
73
|
}
|
73
74
|
|
74
75
|
EXPRESSION_PRECEDES_PROPERTIES_CREATABLES = {"SINK"}
|
76
|
+
|
77
|
+
def computedcolumnconstraint_sql(self, expression: exp.ComputedColumnConstraint) -> str:
|
78
|
+
return Generator.computedcolumnconstraint_sql(self, expression)
|
@@ -863,8 +863,14 @@ class Snowflake(Dialect):
|
|
863
863
|
properties=self._parse_properties(),
|
864
864
|
)
|
865
865
|
|
866
|
-
def _parse_get(self) ->
|
866
|
+
def _parse_get(self) -> t.Optional[exp.Expression]:
|
867
867
|
start = self._prev
|
868
|
+
|
869
|
+
# If we detect GET( then we need to parse a function, not a statement
|
870
|
+
if self._match(TokenType.L_PAREN):
|
871
|
+
self._retreat(self._index - 2)
|
872
|
+
return self._parse_expression()
|
873
|
+
|
868
874
|
target = self._parse_location_path()
|
869
875
|
|
870
876
|
# Parse as command if unquoted file path
|
@@ -1019,6 +1025,7 @@ class Snowflake(Dialect):
|
|
1019
1025
|
exp.ArgMin: rename_func("MIN_BY"),
|
1020
1026
|
exp.ArrayConcat: lambda self, e: self.arrayconcat_sql(e, name="ARRAY_CAT"),
|
1021
1027
|
exp.ArrayContains: lambda self, e: self.func("ARRAY_CONTAINS", e.expression, e.this),
|
1028
|
+
exp.ArrayIntersect: rename_func("ARRAY_INTERSECTION"),
|
1022
1029
|
exp.AtTimeZone: lambda self, e: self.func(
|
1023
1030
|
"CONVERT_TIMEZONE", e.args.get("zone"), e.this
|
1024
1031
|
),
|
@@ -1094,11 +1101,14 @@ class Snowflake(Dialect):
|
|
1094
1101
|
exp.SHA: rename_func("SHA1"),
|
1095
1102
|
exp.StarMap: rename_func("OBJECT_CONSTRUCT"),
|
1096
1103
|
exp.StartsWith: rename_func("STARTSWITH"),
|
1104
|
+
exp.EndsWith: rename_func("ENDSWITH"),
|
1097
1105
|
exp.StrPosition: lambda self, e: strposition_sql(
|
1098
1106
|
self, e, func_name="CHARINDEX", supports_position=True
|
1099
1107
|
),
|
1100
1108
|
exp.StrToDate: lambda self, e: self.func("DATE", e.this, self.format_time(e)),
|
1109
|
+
exp.StringToArray: rename_func("STRTOK_TO_ARRAY"),
|
1101
1110
|
exp.Stuff: rename_func("INSERT"),
|
1111
|
+
exp.StPoint: rename_func("ST_MAKEPOINT"),
|
1102
1112
|
exp.TimeAdd: date_delta_sql("TIMEADD"),
|
1103
1113
|
exp.Timestamp: no_timestamp_sql,
|
1104
1114
|
exp.TimestampAdd: date_delta_sql("TIMESTAMPADD"),
|
@@ -163,6 +163,7 @@ class Spark(Spark2):
|
|
163
163
|
move_partitioned_by_to_schema_columns,
|
164
164
|
]
|
165
165
|
),
|
166
|
+
exp.EndsWith: rename_func("ENDSWITH"),
|
166
167
|
exp.PartitionedByProperty: lambda self,
|
167
168
|
e: f"PARTITIONED BY {self.wrap(self.expressions(sqls=[_normalize_partition(e) for e in e.this.expressions], skip_first=True))}",
|
168
169
|
exp.StartsWith: rename_func("STARTSWITH"),
|
@@ -99,6 +99,8 @@ class SQLite(Dialect):
|
|
99
99
|
KEYWORDS = tokens.Tokenizer.KEYWORDS.copy()
|
100
100
|
KEYWORDS.pop("/*+")
|
101
101
|
|
102
|
+
COMMANDS = {*tokens.Tokenizer.COMMANDS, TokenType.REPLACE}
|
103
|
+
|
102
104
|
class Parser(parser.Parser):
|
103
105
|
FUNCTIONS = {
|
104
106
|
**parser.Parser.FUNCTIONS,
|
@@ -107,7 +109,9 @@ class SQLite(Dialect):
|
|
107
109
|
"DATETIME": lambda args: exp.Anonymous(this="DATETIME", expressions=args),
|
108
110
|
"TIME": lambda args: exp.Anonymous(this="TIME", expressions=args),
|
109
111
|
}
|
112
|
+
|
110
113
|
STRING_ALIASES = True
|
114
|
+
ALTER_RENAME_REQUIRES_COLUMN = False
|
111
115
|
|
112
116
|
def _parse_unique(self) -> exp.UniqueColumnConstraint:
|
113
117
|
# Do not consume more tokens if UNIQUE is used as a standalone constraint, e.g:
|
@@ -307,3 +311,10 @@ class SQLite(Dialect):
|
|
307
311
|
@unsupported_args("this")
|
308
312
|
def currentschema_sql(self, expression: exp.CurrentSchema) -> str:
|
309
313
|
return "'main'"
|
314
|
+
|
315
|
+
def ignorenulls_sql(self, expression: exp.IgnoreNulls) -> str:
|
316
|
+
self.unsupported("SQLite does not support IGNORE NULLS.")
|
317
|
+
return self.sql(expression.this)
|
318
|
+
|
319
|
+
def respectnulls_sql(self, expression: exp.RespectNulls) -> str:
|
320
|
+
return self.sql(expression.this)
|
@@ -17,6 +17,19 @@ from sqlglot.helper import seq_get
|
|
17
17
|
from sqlglot.tokens import TokenType
|
18
18
|
|
19
19
|
|
20
|
+
# https://docs.starrocks.io/docs/sql-reference/sql-functions/spatial-functions/st_distance_sphere/
|
21
|
+
def st_distance_sphere(self, expression: exp.StDistance) -> str:
|
22
|
+
point1 = expression.this
|
23
|
+
point2 = expression.expression
|
24
|
+
|
25
|
+
point1_x = self.func("ST_X", point1)
|
26
|
+
point1_y = self.func("ST_Y", point1)
|
27
|
+
point2_x = self.func("ST_X", point2)
|
28
|
+
point2_y = self.func("ST_Y", point2)
|
29
|
+
|
30
|
+
return self.func("ST_Distance_Sphere", point1_x, point1_y, point2_x, point2_y)
|
31
|
+
|
32
|
+
|
20
33
|
class StarRocks(MySQL):
|
21
34
|
STRICT_JSON_PATH_SYNTAX = False
|
22
35
|
|
@@ -132,6 +145,8 @@ class StarRocks(MySQL):
|
|
132
145
|
TRANSFORMS = {
|
133
146
|
**MySQL.Generator.TRANSFORMS,
|
134
147
|
exp.Array: inline_array_sql,
|
148
|
+
exp.ArrayAgg: rename_func("ARRAY_AGG"),
|
149
|
+
exp.ArrayFilter: rename_func("ARRAY_FILTER"),
|
135
150
|
exp.ArrayToString: rename_func("ARRAY_JOIN"),
|
136
151
|
exp.ApproxDistinct: approx_count_distinct_sql,
|
137
152
|
exp.DateDiff: lambda self, e: self.func(
|
@@ -141,12 +156,12 @@ class StarRocks(MySQL):
|
|
141
156
|
exp.JSONExtract: arrow_json_extract_sql,
|
142
157
|
exp.Property: property_sql,
|
143
158
|
exp.RegexpLike: rename_func("REGEXP"),
|
159
|
+
exp.StDistance: st_distance_sphere,
|
144
160
|
exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)),
|
145
161
|
exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", unit_to_str(e), e.this),
|
146
162
|
exp.TimeStrToDate: rename_func("TO_DATE"),
|
147
163
|
exp.UnixToStr: lambda self, e: self.func("FROM_UNIXTIME", e.this, self.format_time(e)),
|
148
164
|
exp.UnixToTime: rename_func("FROM_UNIXTIME"),
|
149
|
-
exp.ArrayFilter: rename_func("ARRAY_FILTER"),
|
150
165
|
}
|
151
166
|
|
152
167
|
TRANSFORMS.pop(exp.DateTrunc)
|
@@ -31,6 +31,7 @@ from sqlglot.helper import (
|
|
31
31
|
ensure_collection,
|
32
32
|
ensure_list,
|
33
33
|
seq_get,
|
34
|
+
split_num_words,
|
34
35
|
subclasses,
|
35
36
|
to_bool,
|
36
37
|
)
|
@@ -1723,15 +1724,15 @@ class Column(Condition):
|
|
1723
1724
|
if self.args.get(part)
|
1724
1725
|
]
|
1725
1726
|
|
1726
|
-
def to_dot(self) -> Dot | Identifier:
|
1727
|
+
def to_dot(self, include_dots: bool = True) -> Dot | Identifier:
|
1727
1728
|
"""Converts the column into a dot expression."""
|
1728
1729
|
parts = self.parts
|
1729
1730
|
parent = self.parent
|
1730
1731
|
|
1731
|
-
|
1732
|
-
|
1732
|
+
if include_dots:
|
1733
|
+
while isinstance(parent, Dot):
|
1733
1734
|
parts.append(parent.expression)
|
1734
|
-
|
1735
|
+
parent = parent.parent
|
1735
1736
|
|
1736
1737
|
return Dot.build(deepcopy(parts)) if len(parts) > 1 else parts[0]
|
1737
1738
|
|
@@ -1993,11 +1994,6 @@ class OnUpdateColumnConstraint(ColumnConstraintKind):
|
|
1993
1994
|
pass
|
1994
1995
|
|
1995
1996
|
|
1996
|
-
# https://docs.snowflake.com/en/sql-reference/sql/create-external-table#optional-parameters
|
1997
|
-
class TransformColumnConstraint(ColumnConstraintKind):
|
1998
|
-
pass
|
1999
|
-
|
2000
|
-
|
2001
1997
|
class PrimaryKeyColumnConstraint(ColumnConstraintKind):
|
2002
1998
|
arg_types = {"desc": False, "options": False}
|
2003
1999
|
|
@@ -4757,6 +4753,8 @@ class DataType(Expression):
|
|
4757
4753
|
if udt:
|
4758
4754
|
return DataType(this=DataType.Type.USERDEFINED, kind=dtype, **kwargs)
|
4759
4755
|
raise
|
4756
|
+
elif isinstance(dtype, (Identifier, Dot)) and udt:
|
4757
|
+
return DataType(this=DataType.Type.USERDEFINED, kind=dtype, **kwargs)
|
4760
4758
|
elif isinstance(dtype, DataType.Type):
|
4761
4759
|
data_type_exp = DataType(this=dtype)
|
4762
4760
|
elif isinstance(dtype, DataType):
|
@@ -4798,9 +4796,6 @@ class DataType(Expression):
|
|
4798
4796
|
return False
|
4799
4797
|
|
4800
4798
|
|
4801
|
-
DATA_TYPE = t.Union[str, DataType, DataType.Type]
|
4802
|
-
|
4803
|
-
|
4804
4799
|
# https://www.postgresql.org/docs/15/datatype-pseudo.html
|
4805
4800
|
class PseudoType(DataType):
|
4806
4801
|
arg_types = {"this": True}
|
@@ -4930,6 +4925,10 @@ class AddConstraint(Expression):
|
|
4930
4925
|
arg_types = {"expressions": True}
|
4931
4926
|
|
4932
4927
|
|
4928
|
+
class AddPartition(Expression):
|
4929
|
+
arg_types = {"this": True, "exists": False}
|
4930
|
+
|
4931
|
+
|
4933
4932
|
class AttachOption(Expression):
|
4934
4933
|
arg_types = {"this": True, "expression": False}
|
4935
4934
|
|
@@ -5030,6 +5029,9 @@ class Dot(Binary):
|
|
5030
5029
|
return parts
|
5031
5030
|
|
5032
5031
|
|
5032
|
+
DATA_TYPE = t.Union[str, Identifier, Dot, DataType, DataType.Type]
|
5033
|
+
|
5034
|
+
|
5033
5035
|
class DPipe(Binary):
|
5034
5036
|
arg_types = {"this": True, "expression": True, "safe": False}
|
5035
5037
|
|
@@ -5570,13 +5572,28 @@ class ArrayToString(Func):
|
|
5570
5572
|
_sql_names = ["ARRAY_TO_STRING", "ARRAY_JOIN"]
|
5571
5573
|
|
5572
5574
|
|
5575
|
+
class ArrayIntersect(Func):
|
5576
|
+
arg_types = {"expressions": True}
|
5577
|
+
is_var_len_args = True
|
5578
|
+
_sql_names = ["ARRAY_INTERSECT", "ARRAY_INTERSECTION"]
|
5579
|
+
|
5580
|
+
|
5581
|
+
class StPoint(Func):
|
5582
|
+
arg_types = {"this": True, "expression": True, "null": False}
|
5583
|
+
_sql_names = ["ST_POINT", "ST_MAKEPOINT"]
|
5584
|
+
|
5585
|
+
|
5586
|
+
class StDistance(Func):
|
5587
|
+
arg_types = {"this": True, "expression": True, "use_spheroid": False}
|
5588
|
+
|
5589
|
+
|
5573
5590
|
# https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#string
|
5574
5591
|
class String(Func):
|
5575
5592
|
arg_types = {"this": True, "zone": False}
|
5576
5593
|
|
5577
5594
|
|
5578
5595
|
class StringToArray(Func):
|
5579
|
-
arg_types = {"this": True, "expression":
|
5596
|
+
arg_types = {"this": True, "expression": False, "null": False}
|
5580
5597
|
_sql_names = ["STRING_TO_ARRAY", "SPLIT_BY_STRING", "STRTOK_TO_ARRAY"]
|
5581
5598
|
|
5582
5599
|
|
@@ -6706,6 +6723,11 @@ class StartsWith(Func):
|
|
6706
6723
|
arg_types = {"this": True, "expression": True}
|
6707
6724
|
|
6708
6725
|
|
6726
|
+
class EndsWith(Func):
|
6727
|
+
_sql_names = ["ENDS_WITH", "ENDSWITH"]
|
6728
|
+
arg_types = {"this": True, "expression": True}
|
6729
|
+
|
6730
|
+
|
6709
6731
|
class StrPosition(Func):
|
6710
6732
|
arg_types = {
|
6711
6733
|
"this": True,
|
@@ -7366,7 +7388,7 @@ def _apply_set_operation(
|
|
7366
7388
|
**opts,
|
7367
7389
|
) -> S:
|
7368
7390
|
return reduce(
|
7369
|
-
lambda x, y: set_operation(this=x, expression=y, distinct=distinct),
|
7391
|
+
lambda x, y: set_operation(this=x, expression=y, distinct=distinct, **opts),
|
7370
7392
|
(maybe_parse(e, dialect=dialect, copy=copy, **opts) for e in expressions),
|
7371
7393
|
)
|
7372
7394
|
|
@@ -7962,7 +7984,15 @@ def to_table(
|
|
7962
7984
|
if isinstance(sql_path, Table):
|
7963
7985
|
return maybe_copy(sql_path, copy=copy)
|
7964
7986
|
|
7965
|
-
|
7987
|
+
try:
|
7988
|
+
table = maybe_parse(sql_path, into=Table, dialect=dialect)
|
7989
|
+
except ParseError:
|
7990
|
+
catalog, db, this = split_num_words(sql_path, ".", 3)
|
7991
|
+
|
7992
|
+
if not this:
|
7993
|
+
raise
|
7994
|
+
|
7995
|
+
table = table_(this, db=db, catalog=catalog)
|
7966
7996
|
|
7967
7997
|
for k, v in kwargs.items():
|
7968
7998
|
table.set(k, v)
|
@@ -8110,7 +8140,7 @@ def column(
|
|
8110
8140
|
|
8111
8141
|
@t.overload
|
8112
8142
|
def column(
|
8113
|
-
col: str | Identifier,
|
8143
|
+
col: str | Identifier | Star,
|
8114
8144
|
table: t.Optional[str | Identifier] = None,
|
8115
8145
|
db: t.Optional[str | Identifier] = None,
|
8116
8146
|
catalog: t.Optional[str | Identifier] = None,
|
@@ -8147,8 +8177,11 @@ def column(
|
|
8147
8177
|
Returns:
|
8148
8178
|
The new Column instance.
|
8149
8179
|
"""
|
8180
|
+
if not isinstance(col, Star):
|
8181
|
+
col = to_identifier(col, quoted=quoted, copy=copy)
|
8182
|
+
|
8150
8183
|
this = Column(
|
8151
|
-
this=
|
8184
|
+
this=col,
|
8152
8185
|
table=to_identifier(table, quoted=quoted, copy=copy),
|
8153
8186
|
db=to_identifier(db, quoted=quoted, copy=copy),
|
8154
8187
|
catalog=to_identifier(catalog, quoted=quoted, copy=copy),
|
@@ -1018,6 +1018,7 @@ class Generator(metaclass=_Generator):
|
|
1018
1018
|
persisted = " PERSISTED"
|
1019
1019
|
else:
|
1020
1020
|
persisted = ""
|
1021
|
+
|
1021
1022
|
return f"AS {this}{persisted}"
|
1022
1023
|
|
1023
1024
|
def autoincrementcolumnconstraint_sql(self, _) -> str:
|
@@ -1079,9 +1080,6 @@ class Generator(metaclass=_Generator):
|
|
1079
1080
|
def notnullcolumnconstraint_sql(self, expression: exp.NotNullColumnConstraint) -> str:
|
1080
1081
|
return f"{'' if expression.args.get('allow_null') else 'NOT '}NULL"
|
1081
1082
|
|
1082
|
-
def transformcolumnconstraint_sql(self, expression: exp.TransformColumnConstraint) -> str:
|
1083
|
-
return f"AS {self.sql(expression, 'this')}"
|
1084
|
-
|
1085
1083
|
def primarykeycolumnconstraint_sql(self, expression: exp.PrimaryKeyColumnConstraint) -> str:
|
1086
1084
|
desc = expression.args.get("desc")
|
1087
1085
|
if desc is not None:
|
@@ -3500,6 +3498,10 @@ class Generator(metaclass=_Generator):
|
|
3500
3498
|
def addconstraint_sql(self, expression: exp.AddConstraint) -> str:
|
3501
3499
|
return f"ADD {self.expressions(expression)}"
|
3502
3500
|
|
3501
|
+
def addpartition_sql(self, expression: exp.AddPartition) -> str:
|
3502
|
+
exists = "IF NOT EXISTS " if expression.args.get("exists") else ""
|
3503
|
+
return f"ADD {exists}{self.sql(expression.this)}"
|
3504
|
+
|
3503
3505
|
def distinct_sql(self, expression: exp.Distinct) -> str:
|
3504
3506
|
this = self.expressions(expression, flat=True)
|
3505
3507
|
|