sqlglot 27.3.0__tar.gz → 27.4.0__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-27.3.0 → sqlglot-27.4.0}/CHANGELOG.md +192 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/PKG-INFO +1 -1
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/_version.py +2 -2
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/__init__.py +1 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/bigquery.py +26 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/exasol.py +24 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/fabric.py +50 -1
- sqlglot-27.4.0/sqlglot/dialects/singlestore.py +5 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/snowflake.py +14 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/sqlite.py +22 -1
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/tsql.py +0 -38
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/expressions.py +1 -1
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/generator.py +3 -1
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/annotate_types.py +8 -3
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/optimize_joins.py +2 -1
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/parser.py +5 -1
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot.egg-info/PKG-INFO +1 -1
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot.egg-info/SOURCES.txt +2 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_bigquery.py +8 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_exasol.py +82 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_fabric.py +37 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_hive.py +15 -0
- sqlglot-27.4.0/tests/dialects/test_singlestore.py +20 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_sqlite.py +16 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_tsql.py +0 -36
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/optimize_joins.sql +6 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_optimizer.py +6 -1
- {sqlglot-27.3.0 → sqlglot-27.4.0}/.gitignore +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/.gitpod.yml +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/.pre-commit-config.yaml +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/CONTRIBUTING.md +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/LICENSE +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/MANIFEST.in +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/Makefile +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/README.md +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/pyproject.toml +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/setup.cfg +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/setup.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/__init__.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/__main__.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/_typing.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/athena.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/clickhouse.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/databricks.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/dialect.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/doris.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/dremio.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/drill.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/druid.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/duckdb.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/dune.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/hive.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/materialize.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/mysql.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/oracle.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/postgres.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/presto.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/prql.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/redshift.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/risingwave.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/spark.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/spark2.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/starrocks.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/tableau.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/teradata.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/dialects/trino.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/diff.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/errors.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/executor/__init__.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/executor/context.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/executor/env.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/executor/python.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/executor/table.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/helper.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/jsonpath.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/lineage.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/__init__.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/canonicalize.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/eliminate_ctes.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/eliminate_joins.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/eliminate_subqueries.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/isolate_table_selects.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/merge_subqueries.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/normalize.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/normalize_identifiers.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/optimizer.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/pushdown_predicates.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/pushdown_projections.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/qualify.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/qualify_columns.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/qualify_tables.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/scope.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/simplify.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/optimizer/unnest_subqueries.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/planner.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/py.typed +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/schema.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/serde.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/time.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/tokens.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/transforms.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot/trie.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot.egg-info/dependency_links.txt +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot.egg-info/requires.txt +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot.egg-info/top_level.txt +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglot.png +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/Cargo.lock +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/Cargo.toml +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/benches/dialect_settings.json +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/benches/long.rs +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/benches/token_type_settings.json +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/benches/tokenizer_dialect_settings.json +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/benches/tokenizer_settings.json +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/pyproject.toml +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/src/lib.rs +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/src/settings.rs +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/src/token.rs +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/src/tokenizer.rs +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/sqlglotrs/src/trie.rs +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/__init__.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/__init__.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_athena.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_clickhouse.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_databricks.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_dialect.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_doris.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_dremio.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_drill.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_druid.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_duckdb.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_dune.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_materialize.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_mysql.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_oracle.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_pipe_syntax.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_postgres.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_presto.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_prql.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_redshift.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_risingwave.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_snowflake.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_spark.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_starrocks.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_tableau.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_teradata.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/dialects/test_trino.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/identity.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/jsonpath/LICENSE +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/jsonpath/cts.json +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/annotate_functions.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/annotate_types.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/canonicalize.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/eliminate_ctes.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/eliminate_joins.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/eliminate_subqueries.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/isolate_table_selects.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/merge_subqueries.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/normalize.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/normalize_identifiers.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/optimizer.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/pushdown_cte_alias_columns.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/pushdown_predicates.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/pushdown_projections.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/qualify_columns.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/qualify_columns__invalid.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/qualify_columns__with_invisible.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/qualify_columns_ddl.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/qualify_tables.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/quote_identifiers.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/simplify.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/call_center.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/catalog_page.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/catalog_returns.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/catalog_sales.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/customer.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/customer_address.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/customer_demographics.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/date_dim.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/household_demographics.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/income_band.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/inventory.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/item.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/promotion.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/reason.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/ship_mode.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/store.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/store_returns.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/store_sales.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/time_dim.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/tpc-ds.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/warehouse.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/web_page.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/web_returns.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/web_sales.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-ds/web_site.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-h/customer.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-h/lineitem.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-h/nation.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-h/orders.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-h/part.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-h/partsupp.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-h/region.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-h/supplier.csv.gz +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/tpc-h/tpc-h.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/optimizer/unnest_subqueries.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/partial.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/fixtures/pretty.sql +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/gen_fixtures.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/helpers.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_build.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_dialect_imports.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_diff.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_docs.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_executor.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_expressions.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_generator.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_helper.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_jsonpath.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_lineage.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_parser.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_schema.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_serde.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_time.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_tokens.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_transforms.py +0 -0
- {sqlglot-27.3.0 → sqlglot-27.4.0}/tests/test_transpile.py +0 -0
|
@@ -1,6 +1,196 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
## [v27.3.1] - 2025-07-24
|
|
5
|
+
### :boom: BREAKING CHANGES
|
|
6
|
+
- due to [`48703c4`](https://github.com/tobymao/sqlglot/commit/48703c4fadd9f24de151a63d1bfa74f4b8e71133) - temporarily move VARCHAR length inference logic to Fabric *(commit by [@georgesittas](https://github.com/georgesittas))*:
|
|
7
|
+
|
|
8
|
+
temporarily move VARCHAR length inference logic to Fabric
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### :sparkles: New Features
|
|
12
|
+
- [`4cc321c`](https://github.com/tobymao/sqlglot/commit/4cc321cc1995d538ab0c48a7a0a473c31e76ddff) - **singlestore**: Added initial implementation of SingleStore dialect *(PR [#5447](https://github.com/tobymao/sqlglot/pull/5447) by [@AdalbertMemSQL](https://github.com/AdalbertMemSQL))*
|
|
13
|
+
|
|
14
|
+
### :wrench: Chores
|
|
15
|
+
- [`48703c4`](https://github.com/tobymao/sqlglot/commit/48703c4fadd9f24de151a63d1bfa74f4b8e71133) - **tsql**: temporarily move VARCHAR length inference logic to Fabric *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [v27.3.0] - 2025-07-24
|
|
19
|
+
### :boom: BREAKING CHANGES
|
|
20
|
+
- due to [`d7ccb48`](https://github.com/tobymao/sqlglot/commit/d7ccb48e542c49258e31cc4df45f49beebc2e238) - week/quarter support *(PR [#5374](https://github.com/tobymao/sqlglot/pull/5374) by [@eakmanrq](https://github.com/eakmanrq))*:
|
|
21
|
+
|
|
22
|
+
week/quarter support (#5374)
|
|
23
|
+
|
|
24
|
+
- due to [`b368fba`](https://github.com/tobymao/sqlglot/commit/b368fba59b606e038d445b2ca2d8436e115af3d6) - parse and annotate type for ASCII *(PR [#5377](https://github.com/tobymao/sqlglot/pull/5377) by [@geooo109](https://github.com/geooo109))*:
|
|
25
|
+
|
|
26
|
+
parse and annotate type for ASCII (#5377)
|
|
27
|
+
|
|
28
|
+
- due to [`7f19b31`](https://github.com/tobymao/sqlglot/commit/7f19b31ebd7981e53a8f8ba343b4f3222fe160c7) - annotate type for UNICODE *(PR [#5381](https://github.com/tobymao/sqlglot/pull/5381) by [@geooo109](https://github.com/geooo109))*:
|
|
29
|
+
|
|
30
|
+
annotate type for UNICODE (#5381)
|
|
31
|
+
|
|
32
|
+
- due to [`9e8d3ab`](https://github.com/tobymao/sqlglot/commit/9e8d3abedcffb1c267ed0e6a8332af3b52105d41) - Preserve struct-column parentheses for RisingWave dialect *(PR [#5376](https://github.com/tobymao/sqlglot/pull/5376) by [@MisterWheatley](https://github.com/MisterWheatley))*:
|
|
33
|
+
|
|
34
|
+
Added dialect as argument to `simplify_parens` function
|
|
35
|
+
* style: Ran formatter and tests. Fixed type annotation for simplify_parens
|
|
36
|
+
* Fix: Make dialect in `simplify_parens` optional.
|
|
37
|
+
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
|
|
38
|
+
* Fix(optimizer): Tweaks to make simple non-nested star expand pass unit test for RW
|
|
39
|
+
* Fix(optimizer): Added test for deep nested unpacking for BigQuery and RisingWave
|
|
40
|
+
* style: Ran formatting check
|
|
41
|
+
* fix: Remove unuses function from RisingWave dialect test
|
|
42
|
+
* docs: updated docstring of new _expand_struct_stars_risingwave internal function
|
|
43
|
+
* fix: apply suggestions from code review 2
|
|
44
|
+
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
|
|
45
|
+
* fix(optimizer,risingwave): Ensure that struct star-expansion to the correct level for RisingWave
|
|
46
|
+
Updated logic for expanding (struct_col).* expressions in RisingWave to correctly handle the level of nesting.
|
|
47
|
+
Moved struct expansion tests to tests/fixtures/qualify_columns.sql on behest of maintainers.
|
|
48
|
+
---------
|
|
49
|
+
|
|
50
|
+
- due to [`3223e63`](https://github.com/tobymao/sqlglot/commit/3223e6394fdd3f8e48c68bbb940b661ff8e76fd8) - cast datetimeoffset to datetime2 *(PR [#5385](https://github.com/tobymao/sqlglot/pull/5385) by [@mattiasthalen](https://github.com/mattiasthalen))*:
|
|
51
|
+
|
|
52
|
+
cast datetimeoffset to datetime2 (#5385)
|
|
53
|
+
|
|
54
|
+
- due to [`06cea31`](https://github.com/tobymao/sqlglot/commit/06cea310bd9fd3a9a9fa0ba008596e878a430df8) - support KEY related locks *(PR [#5397](https://github.com/tobymao/sqlglot/pull/5397) by [@geooo109](https://github.com/geooo109))*:
|
|
55
|
+
|
|
56
|
+
support KEY related locks (#5397)
|
|
57
|
+
|
|
58
|
+
- due to [`1014a67`](https://github.com/tobymao/sqlglot/commit/1014a6759b0917ef1bf5af0dbbdcca72214a8dea) - remove redundant todate in dayofweek closes [#5398](https://github.com/tobymao/sqlglot/pull/5398) *(PR [#5399](https://github.com/tobymao/sqlglot/pull/5399) by [@tobymao](https://github.com/tobymao))*:
|
|
59
|
+
|
|
60
|
+
remove redundant todate in dayofweek closes #5398 (#5399)
|
|
61
|
+
|
|
62
|
+
- due to [`b2631ae`](https://github.com/tobymao/sqlglot/commit/b2631aec8d1bdb08decb201b6bd2ba5d927bb121) - annotate type for bigquery BIT_AND, BIT_OR, BIT_XOR, BIT_COUNT *(PR [#5405](https://github.com/tobymao/sqlglot/pull/5405) by [@geooo109](https://github.com/geooo109))*:
|
|
63
|
+
|
|
64
|
+
annotate type for bigquery BIT_AND, BIT_OR, BIT_XOR, BIT_COUNT (#5405)
|
|
65
|
+
|
|
66
|
+
- due to [`5835b8d`](https://github.com/tobymao/sqlglot/commit/5835b8d6c7fe77d9645691bb88021af137ed0bac) - make bracket parsing aware of duckdb MAP func *(PR [#5423](https://github.com/tobymao/sqlglot/pull/5423) by [@geooo109](https://github.com/geooo109))*:
|
|
67
|
+
|
|
68
|
+
make bracket parsing aware of duckdb MAP func (#5423)
|
|
69
|
+
|
|
70
|
+
- due to [`489dc5c`](https://github.com/tobymao/sqlglot/commit/489dc5c2f7506e0fe4de549384dd0f816e9fd12f) - parse and annotate type support for JSON_ARRAY *(PR [#5424](https://github.com/tobymao/sqlglot/pull/5424) by [@geooo109](https://github.com/geooo109))*:
|
|
71
|
+
|
|
72
|
+
parse and annotate type support for JSON_ARRAY (#5424)
|
|
73
|
+
|
|
74
|
+
- due to [`0ed518c`](https://github.com/tobymao/sqlglot/commit/0ed518c67042002ee0af91bee0b9e7093c85f926) - annotate type for bigquery JSON_VALUE *(PR [#5427](https://github.com/tobymao/sqlglot/pull/5427) by [@geooo109](https://github.com/geooo109))*:
|
|
75
|
+
|
|
76
|
+
annotate type for bigquery JSON_VALUE (#5427)
|
|
77
|
+
|
|
78
|
+
- due to [`6091617`](https://github.com/tobymao/sqlglot/commit/6091617067c263e3e834e579b37aa1c601b1ddc7) - annotate type for bigquery JSON_VALUE_ARRAY *(PR [#5428](https://github.com/tobymao/sqlglot/pull/5428) by [@geooo109](https://github.com/geooo109))*:
|
|
79
|
+
|
|
80
|
+
annotate type for bigquery JSON_VALUE_ARRAY (#5428)
|
|
81
|
+
|
|
82
|
+
- due to [`631c851`](https://github.com/tobymao/sqlglot/commit/631c851cbbfbf55cb66a79c2549aeeb443fcab83) - parse and annotate type support for bigquery JSON_TYPE *(PR [#5430](https://github.com/tobymao/sqlglot/pull/5430) by [@geooo109](https://github.com/geooo109))*:
|
|
83
|
+
|
|
84
|
+
parse and annotate type support for bigquery JSON_TYPE (#5430)
|
|
85
|
+
|
|
86
|
+
- due to [`6268f6f`](https://github.com/tobymao/sqlglot/commit/6268f6f39dda1ca5cf2ad0403e219b49c5c9593a) - add default precision to CHAR/VARCHAR create expressions *(PR [#5434](https://github.com/tobymao/sqlglot/pull/5434) by [@mattiasthalen](https://github.com/mattiasthalen))*:
|
|
87
|
+
|
|
88
|
+
add default precision to CHAR/VARCHAR create expressions (#5434)
|
|
89
|
+
|
|
90
|
+
- due to [`8467bad`](https://github.com/tobymao/sqlglot/commit/8467bad405e27c842c989e71588adc39cf2383fc) - add parsing/generating for BigQuery `DECLARE` *(PR [#5442](https://github.com/tobymao/sqlglot/pull/5442) by [@plaflamme](https://github.com/plaflamme))*:
|
|
91
|
+
|
|
92
|
+
add parsing/generating for BigQuery `DECLARE` (#5442)
|
|
93
|
+
|
|
94
|
+
- due to [`79c5c30`](https://github.com/tobymao/sqlglot/commit/79c5c30f3802c6959376b3b0f3c4d055a30b6b43) - transpile STRING_AGG *(PR [#5449](https://github.com/tobymao/sqlglot/pull/5449) by [@geooo109](https://github.com/geooo109))*:
|
|
95
|
+
|
|
96
|
+
transpile STRING_AGG (#5449)
|
|
97
|
+
|
|
98
|
+
- due to [`190f8ab`](https://github.com/tobymao/sqlglot/commit/190f8abe3d3bbda09e2f945287398d2aa9d6a863) - improve BigQuery `UNNEST` transpilation *(PR [#5451](https://github.com/tobymao/sqlglot/pull/5451) by [@georgesittas](https://github.com/georgesittas))*:
|
|
99
|
+
|
|
100
|
+
improve BigQuery `UNNEST` transpilation (#5451)
|
|
101
|
+
|
|
102
|
+
- due to [`3590e75`](https://github.com/tobymao/sqlglot/commit/3590e75c1df2d572e2fea664893dba5565a17e05) - support ? placeholder *(PR [#5455](https://github.com/tobymao/sqlglot/pull/5455) by [@geooo109](https://github.com/geooo109))*:
|
|
103
|
+
|
|
104
|
+
support ? placeholder (#5455)
|
|
105
|
+
|
|
106
|
+
- due to [`cdbf595`](https://github.com/tobymao/sqlglot/commit/cdbf5953171c8d4c8e4a24262f278c6f7d74e057) - Wrap GET_PATH value with PARSE_JSON preemptively *(PR [#5458](https://github.com/tobymao/sqlglot/pull/5458) by [@VaggelisD](https://github.com/VaggelisD))*:
|
|
107
|
+
|
|
108
|
+
Wrap GET_PATH value with PARSE_JSON preemptively (#5458)
|
|
109
|
+
|
|
110
|
+
- due to [`bee82f3`](https://github.com/tobymao/sqlglot/commit/bee82f37ac537780495ff408738d88871208517a) - Remove `UNKNOWN` type from `TRY_CAST` *(PR [#5466](https://github.com/tobymao/sqlglot/pull/5466) by [@VaggelisD](https://github.com/VaggelisD))*:
|
|
111
|
+
|
|
112
|
+
Remove `UNKNOWN` type from `TRY_CAST` (#5466)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### :sparkles: New Features
|
|
116
|
+
- [`b368fba`](https://github.com/tobymao/sqlglot/commit/b368fba59b606e038d445b2ca2d8436e115af3d6) - **optimizer**: parse and annotate type for ASCII *(PR [#5377](https://github.com/tobymao/sqlglot/pull/5377) by [@geooo109](https://github.com/geooo109))*
|
|
117
|
+
- [`7f19b31`](https://github.com/tobymao/sqlglot/commit/7f19b31ebd7981e53a8f8ba343b4f3222fe160c7) - **optimizer**: annotate type for UNICODE *(PR [#5381](https://github.com/tobymao/sqlglot/pull/5381) by [@geooo109](https://github.com/geooo109))*
|
|
118
|
+
- [`f035bf0`](https://github.com/tobymao/sqlglot/commit/f035bf0eb582aa07d4ad79e0ed1958ce0d091ad9) - **dremio**: Add TIME_MAPPING for Dremio dialect *(PR [#5378](https://github.com/tobymao/sqlglot/pull/5378) by [@mateuszpoleski](https://github.com/mateuszpoleski))*
|
|
119
|
+
- [`31cfd0f`](https://github.com/tobymao/sqlglot/commit/31cfd0fc3309bc1080b7a2ba8d40b2aba5c098a3) - **exasol**: add to_date and refactored to_char functions with respect to time mapping *(PR [#5379](https://github.com/tobymao/sqlglot/pull/5379) by [@nnamdi16](https://github.com/nnamdi16))*
|
|
120
|
+
- [`bd3776e`](https://github.com/tobymao/sqlglot/commit/bd3776eaa26d40b44c4cebc2f3838b4055653548) - **doris**: add PROPERTIES_LOCATION mapping for Doris dialect *(PR [#5391](https://github.com/tobymao/sqlglot/pull/5391) by [@xinge-ji](https://github.com/xinge-ji))*
|
|
121
|
+
- [`7eaa67a`](https://github.com/tobymao/sqlglot/commit/7eaa67acb216501046c739f56839418b84f244c0) - **doris**: properly supported PROPERTIES and UNIQUE KEY table prop *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
122
|
+
- [`1e78163`](https://github.com/tobymao/sqlglot/commit/1e78163b829e910e7960c79e7ab118c07d1ecdc3) - **duckdb**: support column access via index *(PR [#5395](https://github.com/tobymao/sqlglot/pull/5395) by [@geooo109](https://github.com/geooo109))*
|
|
123
|
+
- :arrow_lower_right: *addresses issue [#5392](https://github.com/tobymao/sqlglot/issues/5392) opened by [@tekumara](https://github.com/tekumara)*
|
|
124
|
+
- [`1014a67`](https://github.com/tobymao/sqlglot/commit/1014a6759b0917ef1bf5af0dbbdcca72214a8dea) - remove redundant todate in dayofweek closes [#5398](https://github.com/tobymao/sqlglot/pull/5398) *(PR [#5399](https://github.com/tobymao/sqlglot/pull/5399) by [@tobymao](https://github.com/tobymao))*
|
|
125
|
+
- [`be52f78`](https://github.com/tobymao/sqlglot/commit/be52f7866b03e436d103d9201d1a44c6632c643a) - **exasol**: add support for CONVERT_TZ function *(PR [#5401](https://github.com/tobymao/sqlglot/pull/5401) by [@nnamdi16](https://github.com/nnamdi16))*
|
|
126
|
+
- [`d637161`](https://github.com/tobymao/sqlglot/commit/d637161406faf623418f112162268bedb422213b) - **exasol**: add mapping to TIME_TO_STR in exasol dialect *(PR [#5403](https://github.com/tobymao/sqlglot/pull/5403) by [@nnamdi16](https://github.com/nnamdi16))*
|
|
127
|
+
- [`b2631ae`](https://github.com/tobymao/sqlglot/commit/b2631aec8d1bdb08decb201b6bd2ba5d927bb121) - **optimizer**: annotate type for bigquery BIT_AND, BIT_OR, BIT_XOR, BIT_COUNT *(PR [#5405](https://github.com/tobymao/sqlglot/pull/5405) by [@geooo109](https://github.com/geooo109))*
|
|
128
|
+
- [`b81ae62`](https://github.com/tobymao/sqlglot/commit/b81ae629bfb27760ddd832402a86dabe4e65072f) - **exasol**: map STR_TO_TIME to TO_DATE and *(PR [#5407](https://github.com/tobymao/sqlglot/pull/5407) by [@nnamdi16](https://github.com/nnamdi16))*
|
|
129
|
+
- [`c2fb9ab`](https://github.com/tobymao/sqlglot/commit/c2fb9abeb2f077f00278e46efd9573a3806cd218) - add `DateStrToTime` *(PR [#5409](https://github.com/tobymao/sqlglot/pull/5409) by [@betodealmeida](https://github.com/betodealmeida))*
|
|
130
|
+
- [`a95993a`](https://github.com/tobymao/sqlglot/commit/a95993ae4e8aa99969db059a534819a4f0b62b96) - **snowflake**: improve transpilation of queries with UNNEST sources *(PR [#5408](https://github.com/tobymao/sqlglot/pull/5408) by [@georgesittas](https://github.com/georgesittas))*
|
|
131
|
+
- [`7b69f54`](https://github.com/tobymao/sqlglot/commit/7b69f545bbcfeb1e1f2f3b7e0b9757cfd675e4a5) - **snowflake**: Support SEMANTIC_VIEW *(PR [#5414](https://github.com/tobymao/sqlglot/pull/5414) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
132
|
+
- :arrow_lower_right: *addresses issue [#5406](https://github.com/tobymao/sqlglot/issues/5406) opened by [@jkillian](https://github.com/jkillian)*
|
|
133
|
+
- [`7dba6f6`](https://github.com/tobymao/sqlglot/commit/7dba6f64d9a7945bbdef1b6e014d802014567a1e) - **exasol**: map AT TIME ZONE to CONVERT_TZ *(PR [#5416](https://github.com/tobymao/sqlglot/pull/5416) by [@nnamdi16](https://github.com/nnamdi16))*
|
|
134
|
+
- [`25f2c1b`](https://github.com/tobymao/sqlglot/commit/25f2c1bb18f9d073b128150566cb27c0c2da0865) - **postgres**: query placeholders *(PR [#5415](https://github.com/tobymao/sqlglot/pull/5415) by [@geooo109](https://github.com/geooo109))*
|
|
135
|
+
- :arrow_lower_right: *addresses issue [#5412](https://github.com/tobymao/sqlglot/issues/5412) opened by [@aersam](https://github.com/aersam)*
|
|
136
|
+
- [`c309c87`](https://github.com/tobymao/sqlglot/commit/c309c8763a90bf0bce02e21f4088b38d85556cce) - **doris**: support range partitioning *(PR [#5402](https://github.com/tobymao/sqlglot/pull/5402) by [@xinge-ji](https://github.com/xinge-ji))*
|
|
137
|
+
- [`394d3a8`](https://github.com/tobymao/sqlglot/commit/394d3a81ef41d3052c0b0d6e48180c344b7db143) - **dremio**: Add support for DATE_ADD and DATE_SUB *(PR [#5411](https://github.com/tobymao/sqlglot/pull/5411) by [@mateuszpoleski](https://github.com/mateuszpoleski))*
|
|
138
|
+
- [`9cfac4f`](https://github.com/tobymao/sqlglot/commit/9cfac4fb04ce1fd038c3e8cbdb755cc24c052497) - **doris**: enhance partitioning support *(PR [#5421](https://github.com/tobymao/sqlglot/pull/5421) by [@xinge-ji](https://github.com/xinge-ji))*
|
|
139
|
+
- [`a018bea`](https://github.com/tobymao/sqlglot/commit/a018bea159261a3ad4ac082f29e30fe1153995b3) - **exasol**: mapped exp.CurrentUser to exasol CURRENT_USER *(PR [#5422](https://github.com/tobymao/sqlglot/pull/5422) by [@nnamdi16](https://github.com/nnamdi16))*
|
|
140
|
+
- [`489dc5c`](https://github.com/tobymao/sqlglot/commit/489dc5c2f7506e0fe4de549384dd0f816e9fd12f) - **optimizer**: parse and annotate type support for JSON_ARRAY *(PR [#5424](https://github.com/tobymao/sqlglot/pull/5424) by [@geooo109](https://github.com/geooo109))*
|
|
141
|
+
- [`0ed518c`](https://github.com/tobymao/sqlglot/commit/0ed518c67042002ee0af91bee0b9e7093c85f926) - **optimizer**: annotate type for bigquery JSON_VALUE *(PR [#5427](https://github.com/tobymao/sqlglot/pull/5427) by [@geooo109](https://github.com/geooo109))*
|
|
142
|
+
- [`6091617`](https://github.com/tobymao/sqlglot/commit/6091617067c263e3e834e579b37aa1c601b1ddc7) - **optimizer**: annotate type for bigquery JSON_VALUE_ARRAY *(PR [#5428](https://github.com/tobymao/sqlglot/pull/5428) by [@geooo109](https://github.com/geooo109))*
|
|
143
|
+
- [`631c851`](https://github.com/tobymao/sqlglot/commit/631c851cbbfbf55cb66a79c2549aeeb443fcab83) - **optimizer**: parse and annotate type support for bigquery JSON_TYPE *(PR [#5430](https://github.com/tobymao/sqlglot/pull/5430) by [@geooo109](https://github.com/geooo109))*
|
|
144
|
+
- [`732548f`](https://github.com/tobymao/sqlglot/commit/732548ff7a6792cfa38dba8b3b8a73a302532ae7) - **postgresql**: add support for table creation DDL that contains a primary key alongside the INCLUDE keyword *(PR [#5425](https://github.com/tobymao/sqlglot/pull/5425) by [@amosbiras](https://github.com/amosbiras))*
|
|
145
|
+
- [`9f887f1`](https://github.com/tobymao/sqlglot/commit/9f887f14d20cd493b4a0a4489649fc5b9f2ae7fd) - Add support for BETWEEN flags *(PR [#5435](https://github.com/tobymao/sqlglot/pull/5435) by [@mateuszpoleski](https://github.com/mateuszpoleski))*
|
|
146
|
+
- [`edef00a`](https://github.com/tobymao/sqlglot/commit/edef00af9b703ace76871b989d9b94d9c30dcafd) - **duckdb**: Add reset command for duckdb *(PR [#5448](https://github.com/tobymao/sqlglot/pull/5448) by [@themisvaltinos](https://github.com/themisvaltinos))*
|
|
147
|
+
- [`6268f6f`](https://github.com/tobymao/sqlglot/commit/6268f6f39dda1ca5cf2ad0403e219b49c5c9593a) - **tsql**: add default precision to CHAR/VARCHAR create expressions *(PR [#5434](https://github.com/tobymao/sqlglot/pull/5434) by [@mattiasthalen](https://github.com/mattiasthalen))*
|
|
148
|
+
- [`bbf26e9`](https://github.com/tobymao/sqlglot/commit/bbf26e9610bee341d4e6df12a031b05ff6b57861) - **mysql**: Add support for SELECT DISTINCTROW *(PR [#5446](https://github.com/tobymao/sqlglot/pull/5446) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
149
|
+
- :arrow_lower_right: *addresses issue [#5445](https://github.com/tobymao/sqlglot/issues/5445) opened by [@chenweida123](https://github.com/chenweida123)*
|
|
150
|
+
- [`8467bad`](https://github.com/tobymao/sqlglot/commit/8467bad405e27c842c989e71588adc39cf2383fc) - add parsing/generating for BigQuery `DECLARE` *(PR [#5442](https://github.com/tobymao/sqlglot/pull/5442) by [@plaflamme](https://github.com/plaflamme))*
|
|
151
|
+
- [`190f8ab`](https://github.com/tobymao/sqlglot/commit/190f8abe3d3bbda09e2f945287398d2aa9d6a863) - improve BigQuery `UNNEST` transpilation *(PR [#5451](https://github.com/tobymao/sqlglot/pull/5451) by [@georgesittas](https://github.com/georgesittas))*
|
|
152
|
+
- [`dbef44d`](https://github.com/tobymao/sqlglot/commit/dbef44db64d8c80e5000c55c981e0de89054e6eb) - **exasol**: mapped STRPOS to INSTR in exasol dialect *(PR [#5454](https://github.com/tobymao/sqlglot/pull/5454) by [@nnamdi16](https://github.com/nnamdi16))*
|
|
153
|
+
- [`010c34c`](https://github.com/tobymao/sqlglot/commit/010c34c1803df0223cf65263f2fb03b404e5141c) - support `DESC SEMANTIC VIEW` *(PR [#5452](https://github.com/tobymao/sqlglot/pull/5452) by [@betodealmeida](https://github.com/betodealmeida))*
|
|
154
|
+
- [`9795021`](https://github.com/tobymao/sqlglot/commit/9795021ff35bae17ff5a9ba7c5cdb46a75aab63b) - **exasol**: transformed column comments *(PR [#5464](https://github.com/tobymao/sqlglot/pull/5464) by [@nnamdi16](https://github.com/nnamdi16))*
|
|
155
|
+
- [`4c5b687`](https://github.com/tobymao/sqlglot/commit/4c5b68746dcede62ca9d1217bd428f50a1731e2c) - **snowflake**: transpile IS <boolean> (IS can only be used with NULL) *(PR [#5467](https://github.com/tobymao/sqlglot/pull/5467) by [@georgesittas](https://github.com/georgesittas))*
|
|
156
|
+
|
|
157
|
+
### :bug: Bug Fixes
|
|
158
|
+
- [`d7ccb48`](https://github.com/tobymao/sqlglot/commit/d7ccb48e542c49258e31cc4df45f49beebc2e238) - **duckdb**: week/quarter support *(PR [#5374](https://github.com/tobymao/sqlglot/pull/5374) by [@eakmanrq](https://github.com/eakmanrq))*
|
|
159
|
+
- [`252469d`](https://github.com/tobymao/sqlglot/commit/252469d2d0ed221dbb2fde86043506ad15dbe7e5) - **snowflake**: transpile bigquery CURRENT_DATE with timezone *(PR [#5387](https://github.com/tobymao/sqlglot/pull/5387) by [@geooo109](https://github.com/geooo109))*
|
|
160
|
+
- [`7511853`](https://github.com/tobymao/sqlglot/commit/751185325caf838107ecb4e8f35ad77bf3cc9bf2) - **postgres**: add XML type *(PR [#5396](https://github.com/tobymao/sqlglot/pull/5396) by [@geooo109](https://github.com/geooo109))*
|
|
161
|
+
- :arrow_lower_right: *fixes issue [#5393](https://github.com/tobymao/sqlglot/issues/5393) opened by [@aersam](https://github.com/aersam)*
|
|
162
|
+
- [`9e8d3ab`](https://github.com/tobymao/sqlglot/commit/9e8d3abedcffb1c267ed0e6a8332af3b52105d41) - **optimizer**: Preserve struct-column parentheses for RisingWave dialect *(PR [#5376](https://github.com/tobymao/sqlglot/pull/5376) by [@MisterWheatley](https://github.com/MisterWheatley))*
|
|
163
|
+
- [`3223e63`](https://github.com/tobymao/sqlglot/commit/3223e6394fdd3f8e48c68bbb940b661ff8e76fd8) - **fabric**: cast datetimeoffset to datetime2 *(PR [#5385](https://github.com/tobymao/sqlglot/pull/5385) by [@mattiasthalen](https://github.com/mattiasthalen))*
|
|
164
|
+
- [`12b49dd`](https://github.com/tobymao/sqlglot/commit/12b49dd800951a48ea8bc0f01d7c35340236f559) - remove equal sign from CREATE TABLE comment (doris, starrocks) *(PR [#5390](https://github.com/tobymao/sqlglot/pull/5390) by [@xinge-ji](https://github.com/xinge-ji))*
|
|
165
|
+
- [`06cea31`](https://github.com/tobymao/sqlglot/commit/06cea310bd9fd3a9a9fa0ba008596e878a430df8) - **postgres**: support KEY related locks *(PR [#5397](https://github.com/tobymao/sqlglot/pull/5397) by [@geooo109](https://github.com/geooo109))*
|
|
166
|
+
- :arrow_lower_right: *fixes issue [#5394](https://github.com/tobymao/sqlglot/issues/5394) opened by [@aurimasandriusaitis](https://github.com/aurimasandriusaitis)*
|
|
167
|
+
- [`92d93a6`](https://github.com/tobymao/sqlglot/commit/92d93a624b41df8bb4628c1f2d0cbb8c7844c927) - **parser**: do not consume modifier prefixes in group parser, fixes [#5400](https://github.com/tobymao/sqlglot/pull/5400) *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
168
|
+
- [`ba0c801`](https://github.com/tobymao/sqlglot/commit/ba0c801e3dab8e08d4b5f7f73247ec6cfdc667e5) - **tsql**: change READ_ONLY to READONLY *(PR [#5410](https://github.com/tobymao/sqlglot/pull/5410) by [@CrispinStichartFNSB](https://github.com/CrispinStichartFNSB))*
|
|
169
|
+
- [`63da895`](https://github.com/tobymao/sqlglot/commit/63da89563fddc13ee7aec06ee36d8a0f74227ee1) - **risingwave**: Fix RisingWave dialect SQL for MAP datatype declaration *(PR [#5418](https://github.com/tobymao/sqlglot/pull/5418) by [@MisterWheatley](https://github.com/MisterWheatley))*
|
|
170
|
+
- [`edacae1`](https://github.com/tobymao/sqlglot/commit/edacae183fe26ea25bffe1bccd335bf57ed34ecb) - **snowflake**: transpile bigquery GENERATE_DATE_ARRAY with column access *(PR [#5388](https://github.com/tobymao/sqlglot/pull/5388) by [@geooo109](https://github.com/geooo109))*
|
|
171
|
+
- [`5835b8d`](https://github.com/tobymao/sqlglot/commit/5835b8d6c7fe77d9645691bb88021af137ed0bac) - **duckdb**: make bracket parsing aware of duckdb MAP func *(PR [#5423](https://github.com/tobymao/sqlglot/pull/5423) by [@geooo109](https://github.com/geooo109))*
|
|
172
|
+
- :arrow_lower_right: *fixes issue [#5417](https://github.com/tobymao/sqlglot/issues/5417) opened by [@MisterWheatley](https://github.com/MisterWheatley)*
|
|
173
|
+
- [`5c59816`](https://github.com/tobymao/sqlglot/commit/5c59816f5572f8adb1de9c97f0007d19091910ec) - **snowflake**: ALTER TABLE ADD with multiple columns *(PR [#5431](https://github.com/tobymao/sqlglot/pull/5431) by [@geooo109](https://github.com/geooo109))*
|
|
174
|
+
- :arrow_lower_right: *fixes issue [#5426](https://github.com/tobymao/sqlglot/issues/5426) opened by [@ca0904](https://github.com/ca0904)*
|
|
175
|
+
- [`9f860a0`](https://github.com/tobymao/sqlglot/commit/9f860a0ce47f74930efa1afcd86fe7668a40c239) - **snowflake**: ALTER TABLE ADD with IF NOT EXISTS *(PR [#5438](https://github.com/tobymao/sqlglot/pull/5438) by [@geooo109](https://github.com/geooo109))*
|
|
176
|
+
- :arrow_lower_right: *fixes issue [#5432](https://github.com/tobymao/sqlglot/issues/5432) opened by [@ca0904](https://github.com/ca0904)*
|
|
177
|
+
- [`d7b3a26`](https://github.com/tobymao/sqlglot/commit/d7b3a261647e4ce675c84bbf72a33d320099fc01) - **postgres**: transpile duckdb LIST_HAS_ANY and LIST_CONTAINS *(PR [#5440](https://github.com/tobymao/sqlglot/pull/5440) by [@geooo109](https://github.com/geooo109))*
|
|
178
|
+
- :arrow_lower_right: *fixes issue [#5437](https://github.com/tobymao/sqlglot/issues/5437) opened by [@aersam](https://github.com/aersam)*
|
|
179
|
+
- [`79c5c30`](https://github.com/tobymao/sqlglot/commit/79c5c30f3802c6959376b3b0f3c4d055a30b6b43) - **spark**: transpile STRING_AGG *(PR [#5449](https://github.com/tobymao/sqlglot/pull/5449) by [@geooo109](https://github.com/geooo109))*
|
|
180
|
+
- :arrow_lower_right: *fixes issue [#5441](https://github.com/tobymao/sqlglot/issues/5441) opened by [@dxaen](https://github.com/dxaen)*
|
|
181
|
+
- [`3590e75`](https://github.com/tobymao/sqlglot/commit/3590e75c1df2d572e2fea664893dba5565a17e05) - **postgres**: support ? placeholder *(PR [#5455](https://github.com/tobymao/sqlglot/pull/5455) by [@geooo109](https://github.com/geooo109))*
|
|
182
|
+
- :arrow_lower_right: *fixes issue [#5453](https://github.com/tobymao/sqlglot/issues/5453) opened by [@jkillian](https://github.com/jkillian)*
|
|
183
|
+
- [`cdbf595`](https://github.com/tobymao/sqlglot/commit/cdbf5953171c8d4c8e4a24262f278c6f7d74e057) - **snowflake**: Wrap GET_PATH value with PARSE_JSON preemptively *(PR [#5458](https://github.com/tobymao/sqlglot/pull/5458) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
184
|
+
- [`8f16f52`](https://github.com/tobymao/sqlglot/commit/8f16f52859b66e3f8b30fff82f0c1679c7e37a25) - restore default `sql_names` for `DecodeCase` *(PR [#5465](https://github.com/tobymao/sqlglot/pull/5465) by [@georgesittas](https://github.com/georgesittas))*
|
|
185
|
+
- [`bee82f3`](https://github.com/tobymao/sqlglot/commit/bee82f37ac537780495ff408738d88871208517a) - **snowflake**: Remove `UNKNOWN` type from `TRY_CAST` *(PR [#5466](https://github.com/tobymao/sqlglot/pull/5466) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
186
|
+
|
|
187
|
+
### :wrench: Chores
|
|
188
|
+
- [`71b1349`](https://github.com/tobymao/sqlglot/commit/71b1349a26d2b9839899900ef8fdfb1ebc3d68fd) - **postgres, hive**: use ASCII node instead of UNICODE node *(PR [#5380](https://github.com/tobymao/sqlglot/pull/5380) by [@geooo109](https://github.com/geooo109))*
|
|
189
|
+
- [`a5c2245`](https://github.com/tobymao/sqlglot/commit/a5c2245c3e30f5bc3f410edacf3a077ce99f4a80) - improve error msg for PIVOT with missing aggregation *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
190
|
+
- [`59fd875`](https://github.com/tobymao/sqlglot/commit/59fd875cd4ee1c44f9ca20f701215ae64d669d60) - Refactor PRIMARY KEY ... INCLUDE handling *(PR [#5433](https://github.com/tobymao/sqlglot/pull/5433) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
191
|
+
- [`e9bb3e8`](https://github.com/tobymao/sqlglot/commit/e9bb3e8ccb52c76ed77fc5e7d04cf75230b737fa) - Refactor DECLARE statement *(PR [#5450](https://github.com/tobymao/sqlglot/pull/5450) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
192
|
+
|
|
193
|
+
|
|
4
194
|
## [v27.2.0] - 2025-07-22
|
|
5
195
|
### :boom: BREAKING CHANGES
|
|
6
196
|
- due to [`6268f6f`](https://github.com/tobymao/sqlglot/commit/6268f6f39dda1ca5cf2ad0403e219b49c5c9593a) - add default precision to CHAR/VARCHAR create expressions *(PR [#5434](https://github.com/tobymao/sqlglot/pull/5434) by [@mattiasthalen](https://github.com/mattiasthalen))*:
|
|
@@ -6114,3 +6304,5 @@ Changelog
|
|
|
6114
6304
|
[v27.0.0]: https://github.com/tobymao/sqlglot/compare/v26.21.3...v27.0.0
|
|
6115
6305
|
[v27.1.0]: https://github.com/tobymao/sqlglot/compare/v26.31.2...v27.1.0
|
|
6116
6306
|
[v27.2.0]: https://github.com/tobymao/sqlglot/compare/v27.1.0...v27.2.0
|
|
6307
|
+
[v27.3.0]: https://github.com/tobymao/sqlglot/compare/v27.0.1...v27.3.0
|
|
6308
|
+
[v27.3.1]: https://github.com/tobymao/sqlglot/compare/v27.3.0...v27.3.1
|
|
@@ -365,6 +365,31 @@ def _annotate_concat(self: TypeAnnotator, expression: exp.Concat) -> exp.Concat:
|
|
|
365
365
|
return annotated
|
|
366
366
|
|
|
367
367
|
|
|
368
|
+
def _annotate_array(self: TypeAnnotator, expression: exp.Array) -> exp.Array:
|
|
369
|
+
array_args = expression.expressions
|
|
370
|
+
|
|
371
|
+
# BigQuery behaves as follows:
|
|
372
|
+
#
|
|
373
|
+
# SELECT t, TYPEOF(t) FROM (SELECT 'foo') AS t -- foo, STRUCT<STRING>
|
|
374
|
+
# SELECT ARRAY(SELECT 'foo'), TYPEOF(ARRAY(SELECT 'foo')) -- foo, ARRAY<STRING>
|
|
375
|
+
if (
|
|
376
|
+
len(array_args) == 1
|
|
377
|
+
and isinstance(select := array_args[0].unnest(), exp.Select)
|
|
378
|
+
and (query_type := select.meta.get("query_type")) is not None
|
|
379
|
+
and query_type.is_type(exp.DataType.Type.STRUCT)
|
|
380
|
+
and len(query_type.expressions) == 1
|
|
381
|
+
):
|
|
382
|
+
projection_type = query_type.expressions[0].kind.copy()
|
|
383
|
+
array_type = exp.DataType(
|
|
384
|
+
this=exp.DataType.Type.ARRAY,
|
|
385
|
+
expressions=[projection_type],
|
|
386
|
+
nested=True,
|
|
387
|
+
)
|
|
388
|
+
return self._annotate_with_type(expression, array_type)
|
|
389
|
+
|
|
390
|
+
return self._annotate_by_args(expression, "expressions", array=True)
|
|
391
|
+
|
|
392
|
+
|
|
368
393
|
class BigQuery(Dialect):
|
|
369
394
|
WEEK_OFFSET = -1
|
|
370
395
|
UNNEST_COLUMN_ONLY = True
|
|
@@ -445,6 +470,7 @@ class BigQuery(Dialect):
|
|
|
445
470
|
exp.Substring,
|
|
446
471
|
)
|
|
447
472
|
},
|
|
473
|
+
exp.Array: _annotate_array,
|
|
448
474
|
exp.ArrayConcat: lambda self, e: self._annotate_by_args(e, "this", "expressions"),
|
|
449
475
|
exp.Ascii: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
|
|
450
476
|
exp.BitwiseAndAgg: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
|
|
@@ -13,6 +13,12 @@ from sqlglot.generator import unsupported_args
|
|
|
13
13
|
from sqlglot.tokens import TokenType
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
def _sha2_sql(self: Exasol.Generator, expression: exp.SHA2) -> str:
|
|
17
|
+
length = expression.text("length")
|
|
18
|
+
func_name = "HASH_SHA256" if length == "256" else "HASH_SHA512"
|
|
19
|
+
return self.func(func_name, expression.this)
|
|
20
|
+
|
|
21
|
+
|
|
16
22
|
class Exasol(Dialect):
|
|
17
23
|
TIME_MAPPING = {
|
|
18
24
|
"yyyy": "%Y",
|
|
@@ -59,6 +65,10 @@ class Exasol(Dialect):
|
|
|
59
65
|
"BIT_RSHIFT": binary_from_function(exp.BitwiseRightShift),
|
|
60
66
|
"EVERY": lambda args: exp.All(this=seq_get(args, 0)),
|
|
61
67
|
"EDIT_DISTANCE": exp.Levenshtein.from_arg_list,
|
|
68
|
+
"HASH_SHA": exp.SHA.from_arg_list,
|
|
69
|
+
"HASH_SHA1": exp.SHA.from_arg_list,
|
|
70
|
+
"HASH_MD5": exp.MD5.from_arg_list,
|
|
71
|
+
"HASHTYPE_MD5": exp.MD5Digest.from_arg_list,
|
|
62
72
|
"REGEXP_REPLACE": lambda args: exp.RegexpReplace(
|
|
63
73
|
this=seq_get(args, 0),
|
|
64
74
|
expression=seq_get(args, 1),
|
|
@@ -66,6 +76,12 @@ class Exasol(Dialect):
|
|
|
66
76
|
position=seq_get(args, 3),
|
|
67
77
|
occurrence=seq_get(args, 4),
|
|
68
78
|
),
|
|
79
|
+
"HASH_SHA256": lambda args: exp.SHA2(
|
|
80
|
+
this=seq_get(args, 0), length=exp.Literal.number(256)
|
|
81
|
+
),
|
|
82
|
+
"HASH_SHA512": lambda args: exp.SHA2(
|
|
83
|
+
this=seq_get(args, 0), length=exp.Literal.number(512)
|
|
84
|
+
),
|
|
69
85
|
"VAR_POP": exp.VariancePop.from_arg_list,
|
|
70
86
|
"APPROXIMATE_COUNT_DISTINCT": exp.ApproxDistinct.from_arg_list,
|
|
71
87
|
"TO_CHAR": build_formatted_time(exp.ToChar, "exasol"),
|
|
@@ -173,6 +189,14 @@ class Exasol(Dialect):
|
|
|
173
189
|
self, e, func_name="INSTR", supports_position=True, supports_occurrence=True
|
|
174
190
|
)
|
|
175
191
|
),
|
|
192
|
+
# https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha%5B1%5D.htm#HASH_SHA%5B1%5D
|
|
193
|
+
exp.SHA: rename_func("HASH_SHA"),
|
|
194
|
+
# https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha256.htm
|
|
195
|
+
# https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha512.htm
|
|
196
|
+
exp.SHA2: _sha2_sql,
|
|
197
|
+
exp.MD5: rename_func("HASH_MD5"),
|
|
198
|
+
# https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hashtype_md5.htm
|
|
199
|
+
exp.MD5Digest: rename_func("HASHTYPE_MD5"),
|
|
176
200
|
# https://docs.exasol.com/db/latest/sql/create_view.htm
|
|
177
201
|
exp.CommentColumnConstraint: lambda self, e: f"COMMENT IS {self.sql(e, 'this')}",
|
|
178
202
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
from sqlglot import exp
|
|
4
|
+
from sqlglot import exp, transforms
|
|
5
5
|
from sqlglot.dialects.dialect import NormalizationStrategy
|
|
6
6
|
from sqlglot.dialects.tsql import TSQL
|
|
7
7
|
from sqlglot.tokens import TokenType
|
|
@@ -27,6 +27,27 @@ def _cap_data_type_precision(expression: exp.DataType, max_precision: int = 6) -
|
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
def _add_default_precision_to_varchar(expression: exp.Expression) -> exp.Expression:
|
|
31
|
+
"""Transform function to add VARCHAR(MAX) or CHAR(MAX) for cross-dialect conversion."""
|
|
32
|
+
if (
|
|
33
|
+
isinstance(expression, exp.Create)
|
|
34
|
+
and expression.kind == "TABLE"
|
|
35
|
+
and isinstance(expression.this, exp.Schema)
|
|
36
|
+
):
|
|
37
|
+
for column in expression.this.expressions:
|
|
38
|
+
if isinstance(column, exp.ColumnDef):
|
|
39
|
+
column_type = column.kind
|
|
40
|
+
if (
|
|
41
|
+
isinstance(column_type, exp.DataType)
|
|
42
|
+
and column_type.this in (exp.DataType.Type.VARCHAR, exp.DataType.Type.CHAR)
|
|
43
|
+
and not column_type.expressions
|
|
44
|
+
):
|
|
45
|
+
# For transpilation, VARCHAR/CHAR without precision becomes VARCHAR(MAX)/CHAR(MAX)
|
|
46
|
+
column_type.set("expressions", [exp.var("MAX")])
|
|
47
|
+
|
|
48
|
+
return expression
|
|
49
|
+
|
|
50
|
+
|
|
30
51
|
class Fabric(TSQL):
|
|
31
52
|
"""
|
|
32
53
|
Microsoft Fabric Data Warehouse dialect that inherits from T-SQL.
|
|
@@ -60,6 +81,29 @@ class Fabric(TSQL):
|
|
|
60
81
|
"UTINYINT": TokenType.UTINYINT,
|
|
61
82
|
}
|
|
62
83
|
|
|
84
|
+
class Parser(TSQL.Parser):
|
|
85
|
+
def _parse_create(self) -> exp.Create | exp.Command:
|
|
86
|
+
create = super()._parse_create()
|
|
87
|
+
|
|
88
|
+
if isinstance(create, exp.Create):
|
|
89
|
+
# Transform VARCHAR/CHAR without precision to VARCHAR(1)/CHAR(1)
|
|
90
|
+
if create.kind == "TABLE" and isinstance(create.this, exp.Schema):
|
|
91
|
+
for column in create.this.expressions:
|
|
92
|
+
if isinstance(column, exp.ColumnDef):
|
|
93
|
+
column_type = column.kind
|
|
94
|
+
if (
|
|
95
|
+
isinstance(column_type, exp.DataType)
|
|
96
|
+
and column_type.this
|
|
97
|
+
in (exp.DataType.Type.VARCHAR, exp.DataType.Type.CHAR)
|
|
98
|
+
and not column_type.expressions
|
|
99
|
+
):
|
|
100
|
+
# Add default precision of 1 to VARCHAR/CHAR without precision
|
|
101
|
+
# When n isn't specified in a data definition or variable declaration statement, the default length is 1.
|
|
102
|
+
# https://learn.microsoft.com/en-us/sql/t-sql/data-types/char-and-varchar-transact-sql?view=sql-server-ver17#remarks
|
|
103
|
+
column_type.set("expressions", [exp.Literal.number("1")])
|
|
104
|
+
|
|
105
|
+
return create
|
|
106
|
+
|
|
63
107
|
class Generator(TSQL.Generator):
|
|
64
108
|
# Fabric-specific type mappings - override T-SQL types that aren't supported
|
|
65
109
|
# Reference: https://learn.microsoft.com/en-us/fabric/data-warehouse/data-types
|
|
@@ -85,6 +129,11 @@ class Fabric(TSQL):
|
|
|
85
129
|
exp.DataType.Type.XML: "VARCHAR",
|
|
86
130
|
}
|
|
87
131
|
|
|
132
|
+
TRANSFORMS = {
|
|
133
|
+
**TSQL.Generator.TRANSFORMS,
|
|
134
|
+
exp.Create: transforms.preprocess([_add_default_precision_to_varchar]),
|
|
135
|
+
}
|
|
136
|
+
|
|
88
137
|
def datatype_sql(self, expression: exp.DataType) -> str:
|
|
89
138
|
# Check if this is a temporal type that needs precision handling. Fabric limits temporal
|
|
90
139
|
# types to max 6 digits precision. When no precision is specified, we default to 6 digits.
|
|
@@ -1673,3 +1673,17 @@ class Snowflake(Dialect):
|
|
|
1673
1673
|
to=exp.DataType(this=exp.DataType.Type.DATE),
|
|
1674
1674
|
)
|
|
1675
1675
|
return self.sql(expr)
|
|
1676
|
+
|
|
1677
|
+
def dot_sql(self, expression: exp.Dot) -> str:
|
|
1678
|
+
this = expression.this
|
|
1679
|
+
|
|
1680
|
+
if not this.type:
|
|
1681
|
+
from sqlglot.optimizer.annotate_types import annotate_types
|
|
1682
|
+
|
|
1683
|
+
this = annotate_types(this, dialect=self.dialect)
|
|
1684
|
+
|
|
1685
|
+
if not isinstance(this, exp.Dot) and this.is_type(exp.DataType.Type.STRUCT):
|
|
1686
|
+
# Generate colon notation for the top level STRUCT
|
|
1687
|
+
return f"{self.sql(this)}:{self.sql(expression, 'expression')}"
|
|
1688
|
+
|
|
1689
|
+
return super().dot_sql(expression)
|
|
@@ -96,7 +96,12 @@ class SQLite(Dialect):
|
|
|
96
96
|
|
|
97
97
|
NESTED_COMMENTS = False
|
|
98
98
|
|
|
99
|
-
KEYWORDS =
|
|
99
|
+
KEYWORDS = {
|
|
100
|
+
**tokens.Tokenizer.KEYWORDS,
|
|
101
|
+
"ATTACH": TokenType.ATTACH,
|
|
102
|
+
"DETACH": TokenType.DETACH,
|
|
103
|
+
}
|
|
104
|
+
|
|
100
105
|
KEYWORDS.pop("/*+")
|
|
101
106
|
|
|
102
107
|
COMMANDS = {*tokens.Tokenizer.COMMANDS, TokenType.REPLACE}
|
|
@@ -114,6 +119,12 @@ class SQLite(Dialect):
|
|
|
114
119
|
"TIME": lambda args: exp.Anonymous(this="TIME", expressions=args),
|
|
115
120
|
}
|
|
116
121
|
|
|
122
|
+
STATEMENT_PARSERS = {
|
|
123
|
+
**parser.Parser.STATEMENT_PARSERS,
|
|
124
|
+
TokenType.ATTACH: lambda self: self._parse_attach_detach(),
|
|
125
|
+
TokenType.DETACH: lambda self: self._parse_attach_detach(is_attach=False),
|
|
126
|
+
}
|
|
127
|
+
|
|
117
128
|
def _parse_unique(self) -> exp.UniqueColumnConstraint:
|
|
118
129
|
# Do not consume more tokens if UNIQUE is used as a standalone constraint, e.g:
|
|
119
130
|
# CREATE TABLE foo (bar TEXT UNIQUE REFERENCES baz ...)
|
|
@@ -122,6 +133,16 @@ class SQLite(Dialect):
|
|
|
122
133
|
|
|
123
134
|
return super()._parse_unique()
|
|
124
135
|
|
|
136
|
+
def _parse_attach_detach(self, is_attach=True) -> exp.Attach | exp.Detach:
|
|
137
|
+
self._match(TokenType.DATABASE)
|
|
138
|
+
this = self._parse_expression()
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
self.expression(exp.Attach, this=this)
|
|
142
|
+
if is_attach
|
|
143
|
+
else self.expression(exp.Detach, this=this)
|
|
144
|
+
)
|
|
145
|
+
|
|
125
146
|
class Generator(generator.Generator):
|
|
126
147
|
JOIN_HINTS = False
|
|
127
148
|
TABLE_HINTS = False
|
|
@@ -392,27 +392,6 @@ def _timestrtotime_sql(self: TSQL.Generator, expression: exp.TimeStrToTime):
|
|
|
392
392
|
return sql
|
|
393
393
|
|
|
394
394
|
|
|
395
|
-
def _add_default_precision_to_varchar(expression: exp.Expression) -> exp.Expression:
|
|
396
|
-
"""Transform function to add VARCHAR(MAX) or CHAR(MAX) for cross-dialect conversion."""
|
|
397
|
-
if (
|
|
398
|
-
isinstance(expression, exp.Create)
|
|
399
|
-
and expression.kind == "TABLE"
|
|
400
|
-
and isinstance(expression.this, exp.Schema)
|
|
401
|
-
):
|
|
402
|
-
for column in expression.this.expressions:
|
|
403
|
-
if isinstance(column, exp.ColumnDef):
|
|
404
|
-
column_type = column.kind
|
|
405
|
-
if (
|
|
406
|
-
isinstance(column_type, exp.DataType)
|
|
407
|
-
and column_type.this in (exp.DataType.Type.VARCHAR, exp.DataType.Type.CHAR)
|
|
408
|
-
and not column_type.expressions
|
|
409
|
-
):
|
|
410
|
-
# For transpilation, VARCHAR/CHAR without precision becomes VARCHAR(MAX)/CHAR(MAX)
|
|
411
|
-
column_type.set("expressions", [exp.var("MAX")])
|
|
412
|
-
|
|
413
|
-
return expression
|
|
414
|
-
|
|
415
|
-
|
|
416
395
|
def _build_datetrunc(args: t.List) -> exp.TimestampTrunc:
|
|
417
396
|
unit = seq_get(args, 0)
|
|
418
397
|
this = seq_get(args, 1)
|
|
@@ -890,22 +869,6 @@ class TSQL(Dialect):
|
|
|
890
869
|
|
|
891
870
|
create.args["properties"].append("expressions", exp.TemporaryProperty())
|
|
892
871
|
|
|
893
|
-
# Transform VARCHAR/CHAR without precision to VARCHAR(1)/CHAR(1)
|
|
894
|
-
if create.kind == "TABLE" and isinstance(create.this, exp.Schema):
|
|
895
|
-
for column in create.this.expressions:
|
|
896
|
-
if isinstance(column, exp.ColumnDef):
|
|
897
|
-
column_type = column.kind
|
|
898
|
-
if (
|
|
899
|
-
isinstance(column_type, exp.DataType)
|
|
900
|
-
and column_type.this
|
|
901
|
-
in (exp.DataType.Type.VARCHAR, exp.DataType.Type.CHAR)
|
|
902
|
-
and not column_type.expressions
|
|
903
|
-
):
|
|
904
|
-
# Add default precision of 1 to VARCHAR/CHAR without precision
|
|
905
|
-
# When n isn't specified in a data definition or variable declaration statement, the default length is 1.
|
|
906
|
-
# https://learn.microsoft.com/en-us/sql/t-sql/data-types/char-and-varchar-transact-sql?view=sql-server-ver17#remarks
|
|
907
|
-
column_type.set("expressions", [exp.Literal.number("1")])
|
|
908
|
-
|
|
909
872
|
return create
|
|
910
873
|
|
|
911
874
|
def _parse_if(self) -> t.Optional[exp.Expression]:
|
|
@@ -1043,7 +1006,6 @@ class TSQL(Dialect):
|
|
|
1043
1006
|
exp.DateAdd: date_delta_sql("DATEADD"),
|
|
1044
1007
|
exp.DateDiff: date_delta_sql("DATEDIFF"),
|
|
1045
1008
|
exp.CTE: transforms.preprocess([qualify_derived_table_outputs]),
|
|
1046
|
-
exp.Create: transforms.preprocess([_add_default_precision_to_varchar]),
|
|
1047
1009
|
exp.CurrentDate: rename_func("GETDATE"),
|
|
1048
1010
|
exp.CurrentTimestamp: rename_func("GETDATE"),
|
|
1049
1011
|
exp.CurrentTimestampLTZ: rename_func("SYSDATETIMEOFFSET"),
|
|
@@ -3549,7 +3549,9 @@ class Generator(metaclass=_Generator):
|
|
|
3549
3549
|
|
|
3550
3550
|
def addpartition_sql(self, expression: exp.AddPartition) -> str:
|
|
3551
3551
|
exists = "IF NOT EXISTS " if expression.args.get("exists") else ""
|
|
3552
|
-
|
|
3552
|
+
location = self.sql(expression, "location")
|
|
3553
|
+
location = f" {location}" if location else ""
|
|
3554
|
+
return f"ADD {exists}{self.sql(expression.this)}{location}"
|
|
3553
3555
|
|
|
3554
3556
|
def distinct_sql(self, expression: exp.Distinct) -> str:
|
|
3555
3557
|
this = self.expressions(expression, flat=True)
|
|
@@ -313,9 +313,11 @@ class TypeAnnotator(metaclass=_TypeAnnotator):
|
|
|
313
313
|
elif (
|
|
314
314
|
isinstance(source, Scope)
|
|
315
315
|
and isinstance(source.expression, exp.Query)
|
|
316
|
-
and
|
|
316
|
+
and (
|
|
317
|
+
source.expression.meta.get("query_type") or exp.DataType.build("UNKNOWN")
|
|
318
|
+
).is_type(exp.DataType.Type.STRUCT)
|
|
317
319
|
):
|
|
318
|
-
self._set_type(table_column, source.expression.
|
|
320
|
+
self._set_type(table_column, source.expression.meta["query_type"])
|
|
319
321
|
|
|
320
322
|
# Then (possibly) annotate the remaining expressions in the scope
|
|
321
323
|
self._maybe_annotate(scope.expression)
|
|
@@ -335,7 +337,10 @@ class TypeAnnotator(metaclass=_TypeAnnotator):
|
|
|
335
337
|
for cd in struct_type.expressions
|
|
336
338
|
if cd.kind
|
|
337
339
|
):
|
|
338
|
-
|
|
340
|
+
# We don't use `_set_type` on purpose here. If we annotated the query directly, then
|
|
341
|
+
# using it in other contexts (e.g., ARRAY(<query>)) could result in incorrect type
|
|
342
|
+
# annotations, i.e., it shouldn't be interpreted as a STRUCT value.
|
|
343
|
+
scope.expression.meta["query_type"] = struct_type
|
|
339
344
|
|
|
340
345
|
def _maybe_annotate(self, expression: E) -> E:
|
|
341
346
|
if id(expression) in self._visited:
|
|
@@ -79,7 +79,8 @@ def normalize(expression):
|
|
|
79
79
|
if join.kind == "CROSS":
|
|
80
80
|
join.set("on", None)
|
|
81
81
|
else:
|
|
82
|
-
join.
|
|
82
|
+
if join.kind in ("INNER", "OUTER"):
|
|
83
|
+
join.set("kind", None)
|
|
83
84
|
|
|
84
85
|
if not join.args.get("on") and not join.args.get("using"):
|
|
85
86
|
join.set("on", exp.true())
|
|
@@ -7394,7 +7394,11 @@ class Parser(metaclass=_Parser):
|
|
|
7394
7394
|
exists = self._parse_exists(not_=True)
|
|
7395
7395
|
if self._match_pair(TokenType.PARTITION, TokenType.L_PAREN, advance=False):
|
|
7396
7396
|
return self.expression(
|
|
7397
|
-
exp.AddPartition,
|
|
7397
|
+
exp.AddPartition,
|
|
7398
|
+
exists=exists,
|
|
7399
|
+
this=self._parse_field(any_token=True),
|
|
7400
|
+
location=self._match_text_seq("LOCATION", advance=False)
|
|
7401
|
+
and self._parse_property(),
|
|
7398
7402
|
)
|
|
7399
7403
|
|
|
7400
7404
|
return None
|