Skip to content

feat: support every dialect sqlparser exposes - #18

Merged
funcpp merged 2 commits into
mainfrom
feat/expand-dialects
Sep 21, 2026
Merged

funcpp merged 2 commits into
mainfrom
feat/expand-dialects

Conversation

@funcpp

@funcpp funcpp commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Reconstructed from the dialect portion of #16, one of the contributions in #15.

What

Adds the 8 dialects sqlparser 0.62 exposes but this crate did not: duckdb, redshift, spark, clickhouse, sqlite, mssql, oracle, teradata. Dialect now covers all 16.

Name parsing moves into the core crate:

  • impl FromStr for Dialect — canonical names plus the aliases postgres, sparksql, tsql, sqlserver; case-insensitive
  • impl Display for Dialect, Dialect::name(), Dialect::ALL, Dialect::names()
  • UnknownDialect error whose message lists every valid name
  • Dialect becomes #[non_exhaustive] and gains PartialEq/Eq/Hash

The CLI and the Python binding now call str::parse instead of each keeping a copy of the name table.

Why

  • The CLI, the Python binding, and the CLI's error string each held their own list, so adding a dialect meant editing four places. feat: expose lineage uncertainty and expand dialects #16 added its dialects to all of them again.
  • #[non_exhaustive]: adding enum variants is already breaking, so this is the release to mark it — the next dialect addition then isn't.

Differences from #16

Tests

3 new, 91 total:

  • every_dialect_parses_a_basic_query — every variant is wired to a working sqlparser dialect
  • canonical_names_round_tripname() and from_str are separate tables; this keeps them agreeing
  • aliases_and_mixed_case_resolve
cargo fmt --all --check                                           exit 0
cargo clippy --workspace --all-targets --all-features -D warnings exit 0
cargo test --workspace --all-features                             exit 0

CLI checked by hand: -d duckdb, -d tsql, and -d presto (exits 1 with the full list).

Compatibility

Breaking for exhaustive downstream matches on Dialect — a minor bump (0.3.0). CLI behavior is unchanged: unknown names print to stderr and exit 1.

🤖 Generated with Claude Code

funcpp and others added 2 commits September 21, 2026 14:10
Adds DuckDb, Redshift, Spark, ClickHouse, SQLite, MsSql, Oracle, and
Teradata, so `Dialect` now covers all 16 dialects in sqlparser 0.62.

Name handling moves into the core crate as `FromStr`, `Display`,
`Dialect::name`, and `Dialect::ALL`, with a new `UnknownDialect` error
whose message lists every valid name. The CLI and the Python binding each
kept their own copy of the string table; they can now share this one.

`Dialect` becomes `#[non_exhaustive]` and gains `PartialEq`/`Eq`/`Hash`.
sqlparser adds dialects over time, and marking it now — while adding
variants is already a breaking change — keeps the next addition from
being one.

Trino is not included: sqlparser 0.62 has no Trino dialect, and aliasing
it to `GenericDialect` would advertise support that is not there.
`generic` parses Trino/Presto in practice, which the README now says.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The CLI's `parse_dialect` and the Python binding's inline match each held
their own copy of the name table, so every new dialect had to be added in
three places and the CLI's error message listed the names a fourth time.

Both now call `str::parse` and print `UnknownDialect`, which builds the
list from `Dialect::ALL`. CLI behavior is unchanged: unknown names still
print to stderr and exit 1.

README and the Python type stub list the full set.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant