ossie icon indicating copy to clipboard operation
ossie copied to clipboard

Add Lightdash converter

Open ota2000 opened this issue 4 months ago • 0 comments

Resolves #227 (proposed there and welcomed by @khush-bhatia — thank you!)

What

Bidirectional converter between Ossie documents and Lightdash semantic definitions, which live as meta blocks in dbt schema.yml files.

  • Export (osi_to_lightdash): Ossie → Lightdash-flavoured schema.yml dict (columns with meta.dimension, column/model meta.metrics, meta.joins)
  • Import (lightdash_to_osi): existing Lightdash definitions → Ossie, as a migration path into Ossie
  • Lightdash presentation attributes with no OSI vocabulary (label, format, round, group_label, hidden, percentile, ...) round-trip through custom_extensions with a stable vendor_name: "lightdash" (JSON-string data, per the model contract). Structural keys (sql / type / description) are deliberately excluded from the extension so a stale copy can never win over the OSI expression on export.
  • Relationships map to Lightdash meta.joins (sql_on is built from / parsed back into column pairs).

Conventions

Follows the layout being standardized on dev@: package apache-ossie-lightdash, uv packaging (mirroring converters/dbt), osi_to_lightdash.py / lightdash_to_osi.py module naming, ossie-lightdash CLI entry point, ASF headers throughout.

Verification

  • 21 tests, including a structural round-trip of the in-repo TPC-DS example (datasets/sources, fields + dimension-ness, single-dataset metric expressions, relationships all preserved; the two cross-dataset metrics are dropped on export with a CROSS_DATASET_METRIC_DROPPED issue, as documented — a Lightdash model metric cannot reference other tables)
  • CLI smoke: ossie-lightdash export examples/tpcds_semantic_model.yaml ... → import back reproduces 5 datasets / 3 single-dataset metrics / 4 relationships

Notes

  • README documents the full mapping table and known limitations (cross-dataset metrics, percentile handling, primary_key/ai_context not carried, standalone Lightdash YAML mode out of scope for now).
  • For documents also consumed by dbt-core's native OSI parsing, the README recommends importing without --database so one document stays valid across environments (dbt-labs/dbt-core#15649).
  • ICLA: in progress on my side, as noted in #227.

ota2000 avatar Jul 23 '26 05:07 ota2000