Conversation
…icks) Bidirectional, offline converter between Apache Ossie semantic models and Databricks Unity Catalog Metric Views (YAML v1.1), filling the DATABRICKS spoke already listed in converters/index.md. Packaged like the dbt/gooddata spokes: pyproject.toml (apache-ossie-databricks), an ossie_databricks package under src/, ASF license headers, and a tests/ suite (example-based + Hypothesis property-based round-trip; 73 tests). PyYAML is the only runtime dependency.
Restores the line to its original form; the stray trailing space violated the repo's .editorconfig (trim_trailing_whitespace = true).
jbonofre
left a comment
There was a problem hiding this comment.
@Haoranli503 I suggest to rename everything to Ossie.
Feel free to close this PR to create a new one (now that the transfer is done).
| @@ -0,0 +1,658 @@ | |||
| # Licensed to the Apache Software Foundation (ASF) under one | |||
There was a problem hiding this comment.
@Haoranli503 I would rename this file to ossie_to_metric_view.py now.
| if dim is None: | ||
| dropped_dims.add(fname) | ||
| continue | ||
| if dim["name"].lower() in seen_dims: # case-insensitive |
There was a problem hiding this comment.
Here, we flatten every dataset's fields into the Metric View's single dimensions list, it tracks names it has already emitted in a seen_dims set and checks for collisions case-insensitive.
The same pattern applies to measures in _convert_metric (which shares the seen_dims/seen_names set, so a measure can also collide with a dimension:
if name.lower() in seen_names:
_warn(scope, "measure name collides with another dimension/measure; rename before use")
seen_names.add(name.lower())
So on a name collision it emits a warning to stderr but still appends the duplicate to the output.
I suggest to made this a ConversionError to be consistent with the rest of the converter: the user gets told exactly which field to rename before they hand a broken file to Databricks.
@Haoranli503 ^^
Add Databricks Unity Catalog Metric View converter
Adds a bidirectional, offline converter between Apache Ossie semantic models and Databricks Unity Catalog Metric Views (YAML v1.1), filling the Databricks spoke in the hub-and-spoke architecture (
DATABRICKSis already a listed vendor inconverters/index.md). Validated against the live Databricks Metric View engine.What's included
ossie-databricks export): Apache Ossie semantic model -> Metric View (one factsource+ a nestedjoinstree, flatteneddimensions,measures).ossie-databricks import): Metric View -> Apache Ossie. Metric-View-only features (filter, window, format, rely, cardinality, parameters, materialization) are preserved incustom_extensions[DATABRICKS], soMV -> Apache Ossie -> MVis lossless.ossie-databricksCLI and a string-in / string-out Python API.Design highlights
custom_extensions[DATABRICKS]stash -- the approach the converter guide recommends.joinstree; a dataset reached by multiple paths (a diamond) is fanned out into one aliased join per path; cyclic graphs are rejected.many_to_one/one_to_manyis derived from the relationshipfrom/todirection relative to a selectable grain (--source). Multiple facts are supported only narrowly -- when they share a conformed dimension (named as the source); a general galaxy schema (facts each with their own dimensions) or facts sharing no dimension can't map to one Metric View and are rejected with a clear error, never silently mis-converted.primary_key/unique_keyswhose columns cover a join key becomesrely: {at_most_one_match: true}, and vice versa.ConversionError; anything dropped (a foreign-vendor extension, an Apache-Ossie-only annotation, a non-DATABRICKS/ANSI_SQL dialect) emits a warning naming the object.Conventions followed
converters/databricks/, packaged like the dbt/gooddata spokes:pyproject.toml(hatchling, Apache-2.0),src/ossie_databricks/,tests/.DATABRICKS, falls back toANSI_SQL.Testing
Example-based unit tests plus Hypothesis property-based round-trip tests in both directions, with a normalized TPC-DS fixture as a baseline.
Notes
custom_extensionshave no slot in the Metric View YAML; they are dropped on export with a warning.Credits
@jackstein21 is credited as a co-contributor (see the commit's
Co-authored-bytrailer), including the property-based round-trip testing approach.