Repository navigation
feat(core-spec): register POSTGRES and REDSHIFT as dialects - #598
Open
403pagelabs wants to merge 2 commits into
Open
403pagelabs wants to merge 2 commits into
403pagelabs wants to merge 2 commits into
Conversation
sqlglot parses PostgreSQL and Amazon Redshift, yet the Dialect enum has no member for either. A semantic model generated for them has to label its expressions ANSI_SQL. The validator then parses the body with the wrong grammar and a converter cannot tell the expression apart from portable SQL. Same pattern as HOLISTICS_AQL in apache#538: the schema enum, spec.md and the generated spec.yaml, the Python OssieDialect enum, the validator's sqlglot map with tests for a Postgres cast and for an unparseable body, the Hex converter's exhaustive dialect maps (Hex names both dialects) and its CLI choices snapshot. I maintain GASP, a SaaS metrics standard, and generate its Ossie model in four dialects (https://gaspwiki.com/downloads/ossie/). The Postgres and Redshift sources travel in a custom extension today because the enum has no value for them.
|
Thank you for your first contribution to Apache Ossie (incubating)! A committer will review your PR. In the meantime, please ensure:
No ICLA is required to contribute. If you are elected as a committer in the future, you will need an Individual Contributor License Agreement (ICLA) on file with the ASF. Questions? Ask in the PR comments or join us on Slack. We appreciate your contribution! |
jbonofre
self-requested a review
October 16, 2026 11:34
jbonofre
requested changes
Oct 16, 2026
…y operator Requested in review on apache#598. The Holistics converter keeps SQLGLOT_DIALECT in sqlrefs.py, which mirrors the validator's DIALECT_MAP and feeds the --sql-dialect choices, so until now neither dialect could be selected and a POSTGRES body fell through to sqlglot's default reader. The validator test now uses the regular-expression match `~`, which the default reader rejects, with an ANSI_SQL control, so it shows the dialect's own reader is used. Both the `::` cast it replaces and ILIKE parse under the default reader.
Author
|
I replied on dev@ to Chris's portability question: https://lists.apache.org/thread/46h1cr804mn6m4r35vrqn1tkdhrjxm7m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sqlglot parses PostgreSQL and Amazon Redshift, yet the
Dialectenum has no member for either. A semantic model generated for them has to label its expressionsANSI_SQL. The validator then parses the body with the wrong grammar and a converter cannot tell the expression apart from portable SQL.Change
Same pattern as
HOLISTICS_AQLin #538:core-spec/ossie-schema.json:POSTGRESandREDSHIFTin$defs.Dialect.enum, the two rows inspec.md, andspec.yamlregenerated withscripts/generate-spec-types.py --applypython/src/ossie/models.py: the twoOssieDialectmembersvalidation/validate.py: both map to their sqlglot dialect, so they are parsed rather than skipped. Tests cover the map entries, the Postgres regular-expression match~validating under each dialect with anANSI_SQLcontrol that rejects it, and an unparseable body reported under eachconverters/hex: both exhaustive dialect maps (Hex names both dialects and its vendored sqlglot has both), the parametrised test and the CLI choices snapshotconverters/holistics:SQLGLOT_DIALECTinsqlrefs.py, which mirrors the validator's map and feeds the--sql-dialectchoices, and the enum listdocs/limitations.mdquotesImpact on existing implementations
The change is additive and no existing value changes meaning. A consumer that switches over the whole enum, as the Hex converter does with
assert_never, gains two cases. The converters in this repository are handled here.Why
I maintain GASP, a SaaS metrics standard, and generate its Ossie ontology, semantic model and mapping in four dialects (https://gaspwiki.com/downloads/ossie/). The Snowflake, BigQuery and Databricks sources carry their dialect. The Postgres and Redshift sources travel in a custom extension today because the enum has no value for them.
Checks run locally: validation (205), the Python package (174), the Hex converter (232 tests, ruff, ty and format),
generate-spec-types.py --check, the four example validations anddev/check-license.