Databricks Unity Catalog Metric View converter#152
Conversation
Add entries for Python build artifacts, Hypothesis test database, IDE files, OS junk, and test coverage output.
Add bidirectional converter between OSI semantic model YAML and Databricks Unity Catalog Metric View YAML (v1.1). Import (Metric View → OSI): - Maps fields to OSI fields with DATABRICKS dialect expressions - Maps measures to OSI metrics - Parses JOIN ON/USING clauses into OSI relationships - Preserves synonyms, display_name, and comments as ai_context - Stores Databricks-specific metadata (filter, materialization, window, format) in custom_extensions Export (OSI → Metric View): - Generates valid Metric View YAML per dataset - Selects DATABRICKS dialect with ANSI_SQL fallback - Reconstructs JOIN clauses from OSI relationships - Restores filter and materialization from custom_extensions Also includes: - CLI entry point (osi-databricks import/export) - Comprehensive test suite (unit + Hypothesis property tests) - TPC-DS-based test fixtures - README with mapping table and usage examples
|
Hi, we're currently working on a Databricks converter internally, which should be available later this week. We really appreciate the effort, but we'd prefer to use our version of the converter in OSI so it's easier for us to manage and update over time. |
|
@Haoranli503 maybe we can collaborate all together on a converter? |
|
Yes, let me go through this, seems we are using similar approach. |
|
Hi @jackstein21 I scanned over this PR. Overall very well done. Thanks for this implementation! We also built the same bidirectional converter and have been validating it against the live Metric View engine, so sharing a quick comparison here to help converge on one implementation. What this PR does well:
Something that this PR doesn't have: The converter assumes a denormalized OSI model: all fields flattened onto a single fact dataset (as in
We have all of the above working and engine-validated: a single fact + join tree with a grain selector, diamond fan-out for shared dimensions, alias requalification, cardinality/one_to_many derivation, the primary-key <-> The other parts are very similar. For maintainability, we'd like to land one final version in OSI. Would you be open to a new PR that combines your property-test work with our converter and adds you as a co-contributor? Happy to work and discuss further on Slack. I am Evan on the OSI slack channel. |
|
@Haoranli503 thanks for the detailed feedback on this. Extremely happy to hear that there is an internal effort to bridge the Databricks/OSI gap. I am completely open to new PR that takes my property tests and combines with your converters. Would love the co-contributor shout out too. |
|
@jackstein21 thank you for your support! We are finalizing everything and should have the pr this week. |
Summary
Adds a bidirectional Python converter between OSI YAML and Databricks Unity Catalog Metric View YAML (v1.1). This fills the Databricks spoke in the hub-and-spoke converter architecture —
DATABRICKSis listed as a supported vendor in the spec andconverters/index.mdbut had no converter implementation until now.What's included
osi-databricks import/osi-databricks exportentry pointsMapping highlights
fields[].exprfield.expression.dialects[DATABRICKS]measures[].exprmetric.expression.dialects[DATABRICKS]joins[].onrelationship.from_columns/to_columnssynonyms,display_nameai_context.synonymscommentdescriptionfilter,materialization,window,formatcustom_extensions(vendor: DATABRICKS)Dialect selection follows the converter guide: prefer DATABRICKS, fall back to ANSI_SQL.
Conventions followed
converters/databricks/withsrc/osi_databricks/layoutosi-python>=0.2.0.dev0andPyYAML>=6.0Testing
cd converters/databricks uv sync uv run pytestAll tests pass locally on Python 3.14.
Notes
This is a tooling/converter contribution, not a spec change
The
.gitignorecommit adds standard entries (build artifacts, Hypothesis DB, IDE files) that benefit all contributorsMetric View materialization support is included but marked as preview (Databricks docs note it's in preview)