polyglot-sql 0.8.0__tar.gz → 0.9.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.
Files changed (208) hide show
  1. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/Cargo.lock +6 -6
  2. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/Cargo.toml +1 -1
  3. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/PKG-INFO +33 -1
  4. {polyglot_sql-0.8.0/crates/polyglot-sql-python → polyglot_sql-0.9.0}/README.md +32 -0
  5. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/Cargo.toml +2 -2
  6. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/README.md +1 -1
  7. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/ast_transforms.rs +25 -89
  8. polyglot_sql-0.9.0/crates/polyglot-sql/src/builder/engine.rs +825 -0
  9. polyglot_sql-0.8.0/crates/polyglot-sql/src/builder.rs → polyglot_sql-0.9.0/crates/polyglot-sql/src/builder/mod.rs +578 -644
  10. polyglot_sql-0.9.0/crates/polyglot-sql/src/builder/plan.rs +1482 -0
  11. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/bigquery.rs +27 -0
  12. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/mod.rs +555 -32
  13. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/aggregates.rs +112 -1
  14. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/json.rs +63 -0
  15. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/mod.rs +94 -19
  16. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/operators.rs +437 -0
  17. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/scalar.rs +426 -16
  18. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/temporal.rs +76 -0
  19. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/types.rs +15 -10
  20. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/snowflake.rs +96 -2
  21. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/tsql.rs +215 -28
  22. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/generator.rs +161 -9
  23. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/parser.rs +117 -11
  24. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/tokens.rs +18 -3
  25. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/transforms.rs +337 -15
  26. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/common/known_failures.rs +19 -0
  27. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/dialect_matrix.rs +878 -1
  28. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/fabric_regression.rs +225 -2
  29. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/snowflake_regression_test.rs +117 -1
  30. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/sqlglot_compat.rs +23 -0
  31. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/tsql_regression.rs +245 -10
  32. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0/crates/polyglot-sql-python}/README.md +32 -0
  33. polyglot_sql-0.9.0/crates/polyglot-sql-python/src/builders.rs +642 -0
  34. polyglot_sql-0.9.0/crates/polyglot-sql-python/src/expr.rs +1568 -0
  35. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/lib.rs +2 -0
  36. polyglot_sql-0.9.0/crates/polyglot-sql-python/tests/test_builders.py +132 -0
  37. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/python/polyglot_sql/__init__.py +208 -0
  38. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/python/polyglot_sql/__init__.pyi +132 -0
  39. polyglot_sql-0.8.0/crates/polyglot-sql-python/src/expr.rs +0 -728
  40. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/benches/allocation_hotspots.rs +0 -0
  41. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/benches/ast_traversal.rs +0 -0
  42. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/benches/in_list.rs +0 -0
  43. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/benches/lineage.rs +0 -0
  44. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/benches/parsing.rs +0 -0
  45. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/benches/performance_hotspots.rs +0 -0
  46. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
  47. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/benches/transpile.rs +0 -0
  48. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
  49. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/examples/bench_json.rs +0 -0
  50. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/ast_children.rs +0 -0
  51. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/ast_json.rs +0 -0
  52. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
  53. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
  54. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
  55. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
  56. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
  57. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
  58. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
  59. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
  60. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
  61. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
  62. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
  63. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
  64. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
  65. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
  66. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
  67. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
  68. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
  69. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/collections.rs +0 -0
  70. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/postgres_interval.rs +0 -0
  71. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/normalization/statements.rs +0 -0
  72. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
  73. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
  74. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
  75. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
  76. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
  77. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
  78. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
  79. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
  80. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
  81. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
  82. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
  83. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
  84. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
  85. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
  86. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/diff.rs +0 -0
  87. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/error.rs +0 -0
  88. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/expressions.rs +0 -0
  89. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/format_tokens.rs +0 -0
  90. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/function_catalog.rs +0 -0
  91. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/function_registry.rs +0 -0
  92. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/guard.rs +0 -0
  93. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/helper.rs +0 -0
  94. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/lib.rs +0 -0
  95. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/lineage.rs +0 -0
  96. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/openlineage.rs +0 -0
  97. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/annotate_types.rs +0 -0
  98. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
  99. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
  100. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
  101. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
  102. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
  103. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
  104. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
  105. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
  106. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
  107. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
  108. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
  109. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +0 -0
  110. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
  111. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
  112. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
  113. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/planner.rs +0 -0
  114. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/query_analysis.rs +0 -0
  115. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/resolver.rs +0 -0
  116. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/schema.rs +0 -0
  117. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/scope.rs +0 -0
  118. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/time.rs +0 -0
  119. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/traversal.rs +0 -0
  120. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/trie.rs +0 -0
  121. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/validation/tests.rs +0 -0
  122. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/src/validation.rs +0 -0
  123. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
  124. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
  125. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/common/mod.rs +0 -0
  126. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
  127. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
  128. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +0 -0
  129. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
  130. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
  131. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
  132. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
  133. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
  134. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
  135. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
  136. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
  137. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
  138. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
  139. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
  140. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
  141. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
  142. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
  143. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/error_handling.rs +0 -0
  144. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
  145. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
  146. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/oracle_data_types_regression.rs +0 -0
  147. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/postgres_explain_options.rs +0 -0
  148. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/postgres_regexp_clickhouse.rs +0 -0
  149. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
  150. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/query_analysis.rs +0 -0
  151. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
  152. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
  153. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
  154. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
  155. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
  156. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
  157. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
  158. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
  159. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
  160. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
  161. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-ast-derive/Cargo.toml +0 -0
  162. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-ast-derive/src/lib.rs +0 -0
  163. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
  164. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-function-catalogs/README.md +0 -0
  165. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
  166. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
  167. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
  168. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
  169. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
  170. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/Cargo.toml +0 -0
  171. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/docs/api.md +0 -0
  172. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/docs/index.md +0 -0
  173. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/mkdocs.yml +0 -0
  174. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
  175. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/dialects.rs +0 -0
  176. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/diff.rs +0 -0
  177. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/errors.rs +0 -0
  178. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
  179. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/format.rs +0 -0
  180. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/generate.rs +0 -0
  181. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/helpers.rs +0 -0
  182. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/lineage.rs +0 -0
  183. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
  184. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/optimize.rs +0 -0
  185. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/parse.rs +0 -0
  186. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
  187. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
  188. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/transforms.rs +0 -0
  189. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/transpile.rs +0 -0
  190. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/types.rs +0 -0
  191. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/src/validate.rs +0 -0
  192. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/conftest.py +0 -0
  193. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
  194. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
  195. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
  196. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
  197. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_format.py +0 -0
  198. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
  199. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
  200. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
  201. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
  202. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
  203. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
  204. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
  205. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
  206. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/crates/polyglot-sql-python/uv.lock +0 -0
  207. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/pyproject.toml +0 -0
  208. {polyglot_sql-0.8.0 → polyglot_sql-0.9.0}/python/polyglot_sql/py.typed +0 -0
@@ -605,7 +605,7 @@ dependencies = [
605
605
 
606
606
  [[package]]
607
607
  name = "polyglot-sql"
608
- version = "0.8.0"
608
+ version = "0.9.0"
609
609
  dependencies = [
610
610
  "criterion",
611
611
  "once_cell",
@@ -623,7 +623,7 @@ dependencies = [
623
623
 
624
624
  [[package]]
625
625
  name = "polyglot-sql-ast-derive"
626
- version = "0.8.0"
626
+ version = "0.9.0"
627
627
  dependencies = [
628
628
  "proc-macro2",
629
629
  "quote",
@@ -632,7 +632,7 @@ dependencies = [
632
632
 
633
633
  [[package]]
634
634
  name = "polyglot-sql-ffi"
635
- version = "0.8.0"
635
+ version = "0.9.0"
636
636
  dependencies = [
637
637
  "cbindgen",
638
638
  "polyglot-sql",
@@ -642,11 +642,11 @@ dependencies = [
642
642
 
643
643
  [[package]]
644
644
  name = "polyglot-sql-function-catalogs"
645
- version = "0.8.0"
645
+ version = "0.9.0"
646
646
 
647
647
  [[package]]
648
648
  name = "polyglot-sql-python"
649
- version = "0.8.0"
649
+ version = "0.9.0"
650
650
  dependencies = [
651
651
  "polyglot-sql",
652
652
  "pyo3",
@@ -657,7 +657,7 @@ dependencies = [
657
657
 
658
658
  [[package]]
659
659
  name = "polyglot-sql-wasm"
660
- version = "0.8.0"
660
+ version = "0.9.0"
661
661
  dependencies = [
662
662
  "console_error_panic_hook",
663
663
  "js-sys",
@@ -6,7 +6,7 @@ exclude = [
6
6
  ]
7
7
 
8
8
  [workspace.package]
9
- version = "0.8.0"
9
+ version = "0.9.0"
10
10
  edition = "2021"
11
11
  license = "MIT"
12
12
  authors = ["polyglot contributors"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyglot-sql
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -68,6 +68,38 @@ polyglot_sql.parse_one("VARCHAR(255)", dialect="duckdb", into=polyglot_sql.DataT
68
68
  polyglot_sql.format_sql("SELECT a,b FROM t WHERE x=1", dialect="postgres")
69
69
  ```
70
70
 
71
+ ### SQLGlot-Compatible Builders
72
+
73
+ The common SQLGlot builder surface is available directly from
74
+ `polyglot_sql`. Builders return normal Polyglot expression objects and are
75
+ immutable: each chained call returns a new expression.
76
+
77
+ ```python
78
+ query = (
79
+ polyglot_sql.select("customer_id", "COUNT(*) AS orders")
80
+ .from_("orders")
81
+ .where("status = 'complete'")
82
+ .group_by("customer_id")
83
+ .order_by("orders DESC")
84
+ .limit(10)
85
+ )
86
+
87
+ query.sql("postgres")
88
+ # "SELECT customer_id, COUNT(*) AS orders FROM orders WHERE status = 'complete' GROUP BY customer_id ORDER BY orders DESC LIMIT 10"
89
+
90
+ active = polyglot_sql.column("status").eq("active")
91
+ active.sql()
92
+ # "status = 'active'"
93
+ ```
94
+
95
+ The shared builder feature set also includes named aggregate/string/math/date
96
+ helpers, all join and set-operation variants, named windows, lateral views,
97
+ hints, row locks, CTAS, `CASE`, `INSERT`, `UPDATE`, `DELETE`, and conditional
98
+ `MERGE` actions. Repeated clauses append by default; pass `append=False` to
99
+ replace one. Advanced parser options, mutable `copy=False` behavior, and the
100
+ complete SQLGlot expression catalog are not included. Polyglot expressions
101
+ remain the native AST type; SQLGlot is not a runtime dependency.
102
+
71
103
  ```python
72
104
  ast = polyglot_sql.parse_one("SELECT id FROM a UNION ALL SELECT id FROM b")
73
105
  order_expr = polyglot_sql.parse_one("SELECT id").args["expressions"][0]
@@ -41,6 +41,38 @@ polyglot_sql.parse_one("VARCHAR(255)", dialect="duckdb", into=polyglot_sql.DataT
41
41
  polyglot_sql.format_sql("SELECT a,b FROM t WHERE x=1", dialect="postgres")
42
42
  ```
43
43
 
44
+ ### SQLGlot-Compatible Builders
45
+
46
+ The common SQLGlot builder surface is available directly from
47
+ `polyglot_sql`. Builders return normal Polyglot expression objects and are
48
+ immutable: each chained call returns a new expression.
49
+
50
+ ```python
51
+ query = (
52
+ polyglot_sql.select("customer_id", "COUNT(*) AS orders")
53
+ .from_("orders")
54
+ .where("status = 'complete'")
55
+ .group_by("customer_id")
56
+ .order_by("orders DESC")
57
+ .limit(10)
58
+ )
59
+
60
+ query.sql("postgres")
61
+ # "SELECT customer_id, COUNT(*) AS orders FROM orders WHERE status = 'complete' GROUP BY customer_id ORDER BY orders DESC LIMIT 10"
62
+
63
+ active = polyglot_sql.column("status").eq("active")
64
+ active.sql()
65
+ # "status = 'active'"
66
+ ```
67
+
68
+ The shared builder feature set also includes named aggregate/string/math/date
69
+ helpers, all join and set-operation variants, named windows, lateral views,
70
+ hints, row locks, CTAS, `CASE`, `INSERT`, `UPDATE`, `DELETE`, and conditional
71
+ `MERGE` actions. Repeated clauses append by default; pass `append=False` to
72
+ replace one. Advanced parser options, mutable `copy=False` behavior, and the
73
+ complete SQLGlot expression catalog are not included. Polyglot expressions
74
+ remain the native AST type; SQLGlot is not a runtime dependency.
75
+
44
76
  ```python
45
77
  ast = polyglot_sql.parse_one("SELECT id FROM a UNION ALL SELECT id FROM b")
46
78
  order_expr = polyglot_sql.parse_one("SELECT id").args["expressions"][0]
@@ -100,14 +100,14 @@ function-catalog-all-dialects = [
100
100
  ]
101
101
 
102
102
  [dependencies]
103
- polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.8.0" }
103
+ polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.9.0" }
104
104
  serde = { workspace = true }
105
105
  serde_json = { workspace = true }
106
106
  thiserror = { workspace = true }
107
107
  unicode-segmentation = { workspace = true }
108
108
  stacker = { version = "0.1", optional = true }
109
109
  ts-rs = { version = "12.0", features = ["serde-compat"], optional = true }
110
- polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.8.0", optional = true, default-features = false }
110
+ polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.9.0", optional = true, default-features = false }
111
111
 
112
112
  [dev-dependencies]
113
113
  pretty_assertions = "1.4"
@@ -25,7 +25,7 @@ By default, `polyglot-sql` enables the full public API. Parser-only consumers ca
25
25
  disable default features and opt into only the dialect parsers they need:
26
26
 
27
27
  ```toml
28
- polyglot-sql = { version = "0.8.0", default-features = false }
28
+ polyglot-sql = { version = "0.9.0", default-features = false }
29
29
  ```
30
30
 
31
31
  ```toml
@@ -9,6 +9,7 @@
9
9
 
10
10
  use std::collections::{HashMap, HashSet};
11
11
 
12
+ use crate::builder::engine;
12
13
  use crate::expressions::*;
13
14
  use crate::traversal::ExpressionWalk;
14
15
 
@@ -28,12 +29,9 @@ fn xform<F: Fn(Expression) -> Expression>(expr: Expression, fun: F) -> Expressio
28
29
  /// If `expr` is a `Select`, the given `columns` are appended to its expression list.
29
30
  /// Non-SELECT expressions are returned unchanged.
30
31
  pub fn add_select_columns(expr: Expression, columns: Vec<Expression>) -> Expression {
31
- if let Expression::Select(mut sel) = expr {
32
- sel.expressions.extend(columns);
33
- Expression::Select(sel)
34
- } else {
35
- expr
36
- }
32
+ let mut expression = expr;
33
+ let _ = engine::append_select(&mut expression, columns, true);
34
+ expression
37
35
  }
38
36
 
39
37
  /// Remove columns from the SELECT list where `predicate` returns `true`.
@@ -51,12 +49,9 @@ pub fn remove_select_columns<F: Fn(&Expression) -> bool>(
51
49
 
52
50
  /// Set or remove the DISTINCT flag on a SELECT.
53
51
  pub fn set_distinct(expr: Expression, distinct: bool) -> Expression {
54
- if let Expression::Select(mut sel) = expr {
55
- sel.distinct = distinct;
56
- Expression::Select(sel)
57
- } else {
58
- expr
59
- }
52
+ let mut expression = expr;
53
+ let _ = engine::apply_distinct(&mut expression, distinct);
54
+ expression
60
55
  }
61
56
 
62
57
  // ---------------------------------------------------------------------------
@@ -69,6 +64,14 @@ pub fn set_distinct(expr: Expression, distinct: bool) -> Expression {
69
64
  /// existing one using AND (default) or OR (when `use_or` is `true`).
70
65
  /// If there is no WHERE clause, one is created.
71
66
  pub fn add_where(expr: Expression, condition: Expression, use_or: bool) -> Expression {
67
+ if !use_or {
68
+ if !matches!(expr, Expression::Select(_)) {
69
+ return expr;
70
+ }
71
+ let mut expression = expr;
72
+ let _ = engine::apply_where(&mut expression, condition, true);
73
+ return expression;
74
+ }
72
75
  if let Expression::Select(mut sel) = expr {
73
76
  sel.where_clause = Some(match sel.where_clause.take() {
74
77
  Some(existing) => {
@@ -108,29 +111,9 @@ pub fn set_limit(expr: Expression, limit: usize) -> Expression {
108
111
 
109
112
  /// Set the LIMIT on a SELECT or set operation using an expression.
110
113
  pub fn set_limit_expr(expr: Expression, limit: Expression) -> Expression {
111
- match expr {
112
- Expression::Select(mut sel) => {
113
- sel.limit = Some(Limit {
114
- this: limit,
115
- percent: false,
116
- comments: Vec::new(),
117
- });
118
- Expression::Select(sel)
119
- }
120
- Expression::Union(mut union) => {
121
- union.limit = Some(Box::new(limit));
122
- Expression::Union(union)
123
- }
124
- Expression::Intersect(mut intersect) => {
125
- intersect.limit = Some(Box::new(limit));
126
- Expression::Intersect(intersect)
127
- }
128
- Expression::Except(mut except) => {
129
- except.limit = Some(Box::new(limit));
130
- Expression::Except(except)
131
- }
132
- other => other,
133
- }
114
+ let mut expression = expr;
115
+ let _ = engine::apply_limit(&mut expression, limit);
116
+ expression
134
117
  }
135
118
 
136
119
  /// Set the OFFSET on a SELECT or set operation.
@@ -140,28 +123,9 @@ pub fn set_offset(expr: Expression, offset: usize) -> Expression {
140
123
 
141
124
  /// Set the OFFSET on a SELECT or set operation using an expression.
142
125
  pub fn set_offset_expr(expr: Expression, offset: Expression) -> Expression {
143
- match expr {
144
- Expression::Select(mut sel) => {
145
- sel.offset = Some(Offset {
146
- this: offset,
147
- rows: None,
148
- });
149
- Expression::Select(sel)
150
- }
151
- Expression::Union(mut union) => {
152
- union.offset = Some(Box::new(offset));
153
- Expression::Union(union)
154
- }
155
- Expression::Intersect(mut intersect) => {
156
- intersect.offset = Some(Box::new(offset));
157
- Expression::Intersect(intersect)
158
- }
159
- Expression::Except(mut except) => {
160
- except.offset = Some(Box::new(offset));
161
- Expression::Except(except)
162
- }
163
- other => other,
164
- }
126
+ let mut expression = expr;
127
+ let _ = engine::apply_offset(&mut expression, offset);
128
+ expression
165
129
  }
166
130
 
167
131
  /// Set the ORDER BY clause on a SELECT or set operation.
@@ -169,38 +133,10 @@ pub fn set_offset_expr(expr: Expression, offset: Expression) -> Expression {
169
133
  /// Bare expressions are normalized to ascending order expressions. Existing
170
134
  /// `Ordered` expressions preserve their direction and null-ordering metadata.
171
135
  pub fn set_order_by(expr: Expression, expressions: Vec<Expression>) -> Expression {
172
- let order_by = OrderBy {
173
- expressions: expressions.into_iter().map(normalize_ordered).collect(),
174
- siblings: false,
175
- comments: Vec::new(),
176
- };
177
-
178
- match expr {
179
- Expression::Select(mut sel) => {
180
- sel.order_by = Some(order_by);
181
- Expression::Select(sel)
182
- }
183
- Expression::Union(mut union) => {
184
- union.order_by = Some(order_by);
185
- Expression::Union(union)
186
- }
187
- Expression::Intersect(mut intersect) => {
188
- intersect.order_by = Some(order_by);
189
- Expression::Intersect(intersect)
190
- }
191
- Expression::Except(mut except) => {
192
- except.order_by = Some(order_by);
193
- Expression::Except(except)
194
- }
195
- other => other,
196
- }
197
- }
198
-
199
- fn normalize_ordered(expression: Expression) -> Ordered {
200
- match expression {
201
- Expression::Ordered(ordered) => *ordered,
202
- other => Ordered::asc(other),
203
- }
136
+ let mut expression = expr;
137
+ let values = expressions.into_iter().map(engine::ordered).collect();
138
+ let _ = engine::apply_order_by(&mut expression, values, false);
139
+ expression
204
140
  }
205
141
 
206
142
  /// Remove both LIMIT and OFFSET from a SELECT.