Skip to content

[OSSIE][SIGMA] Add bidirectional Sigma Computing data model converter - #297

Draft
mattsenicksigma wants to merge 1 commit into
apache:mainfrom
mattsenicksigma:feature/sigma-converter
Draft

[OSSIE][SIGMA] Add bidirectional Sigma Computing data model converter#297
mattsenicksigma wants to merge 1 commit into
apache:mainfrom
mattsenicksigma:feature/sigma-converter

Conversation

@mattsenicksigma

Copy link
Copy Markdown

Summary

Adds converters/sigma, a bidirectional converter between Sigma Computing data model specs and Apache Ossie, following the same structure/tooling as the dbt and NVIDIA GSF converters (uv, the apache-ossie pydantic models).

  • A real tokenizer + recursive-descent parser + ANSI SQL renderer for Sigma's spreadsheet-style formula language (ossie_sigma.sigma_formula), covering ~30 functions and all operators with nested-call support — not a regex classifier. Every expression always preserves the original Sigma formula verbatim in a new SIGMA dialect entry, guaranteeing lossless round-tripping regardless of translation coverage, alongside a best-effort ANSI_SQL translation.
  • Sigma ⇄ OSI mapping for datasets, fields, relationships (including Sigma's two column-addressing schemes — modeled column id vs. raw inode-<file>/<PHYSICAL_COLUMN> warehouse references), and model-level metrics, with native Sigma ids preserved via custom_extensions so re-export reuses stable ids rather than minting new ones.
  • Controls and named/static element filters are intentionally not modeled as OSI concepts (no portable equivalent — see converters/sigma/LIMITATIONS.md §1) but round-trip byte-for-byte via custom_extensions.
  • Adds SIGMA to OSIDialect/OSIVendor (python/src/ossie/models.py), the core-spec schema/docs (core-spec/spec.md, core-spec/osi-schema.json), and a Sigma column in expression_language.md's cross-tool mapping tables.
  • Fixes two small pre-existing gaps found while validating output against the repo's own tooling (documented in LIMITATIONS.md): core-spec/osi-schema.json was missing root-level dialects/vendors properties already present in the pydantic model, and validation/validate.py didn't skip SQL-syntax checking for SIGMA the way it already does for MDX/TABLEAU/MAQL.

See converters/sigma/LIMITATIONS.md for a full, honest accounting of design tradeoffs, known gaps (relationship resolution edge cases, table-calculation functions with no portable form, cross-dataset metrics with no Sigma equivalent, etc.), the testing strategy, and a self-assessment of likely review concerns.

Opening as a draft to gather early feedback on the approach (particularly the relationship-resolution strategy and the SIGMA dialect/vendor enum additions) before finalizing.

Test plan

  • cd converters/sigma && uv sync && uv run pytest — 50 tests pass (formula parser unit tests, directional conversion tests, byte-for-byte round-trip tests for two synthetic fixtures, and a real-world-input test against examples/tpcds_semantic_model.yaml)
  • Verified sigma-to-osi output validates cleanly against core-spec/osi-schema.json and validation/validate.py for both fixtures
  • Re-ran python/, converters/dbt/, and converters/gsf/ test suites to confirm the shared enum/schema changes don't regress existing converters
  • Feedback from a committer on the relationship-resolution approach and whether the SIGMA enum additions need a dev@ discussion or can proceed via normal PR review (see LIMITATIONS.md "Assessment: likelihood of upstream approval")

🤖 Generated with Claude Code

Adds converters/sigma, a hub-and-spoke converter between Sigma Computing
data model specs and Apache Ossie, following the same structure/tooling
as the dbt and NVIDIA GSF converters (uv, apache-ossie pydantic models).

- A real tokenizer/parser/renderer for Sigma's formula language
  (ossie_sigma.sigma_formula), translating to ANSI SQL where a faithful
  mapping exists and always preserving the original formula verbatim in
  a new SIGMA dialect entry for lossless round-tripping.
- Sigma <-> OSI mapping for datasets, fields, relationships (including
  Sigma's two column-addressing schemes), and model-level metrics, with
  native Sigma ids preserved via custom_extensions for stable re-export.
- Controls and named/static filters are intentionally not modeled as OSI
  concepts (no portable equivalent) but round-trip byte-for-byte via
  custom_extensions; see converters/sigma/LIMITATIONS.md for this and
  other documented tradeoffs.
- Adds SIGMA to OSIDialect/OSIVendor (python/src/ossie/models.py) and the
  core-spec schema/docs, plus a Sigma column in the expression_language.md
  cross-tool mapping tables.
- Fixes two small pre-existing gaps found while validating output:
  core-spec/osi-schema.json was missing root-level dialects/vendors
  properties already present in the pydantic model, and
  validation/validate.py didn't skip SQL-syntax checking for the new
  SIGMA dialect the same way it already does for MDX/TABLEAU/MAQL.

Co-Authored-By: Claude Sonnet 5 <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