ossie
ossie copied to clipboard
Add Lightdash converter
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-flavouredschema.ymldict (columns withmeta.dimension, column/modelmeta.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 throughcustom_extensionswith a stablevendor_name: "lightdash"(JSON-stringdata, 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_onis 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_DROPPEDissue, as documented — a Lightdash model metric cannot reference other tables) - CLI smoke:
ossie-lightdash export examples/tpcds_semantic_model.yaml ...→importback 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_contextnot 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
--databaseso one document stays valid across environments (dbt-labs/dbt-core#15649). - ICLA: in progress on my side, as noted in #227.