Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/converter-databricks-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/databricks/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-databricks-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/databricks/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-databricks-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-dbt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/dbt/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-dbt-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/dbt/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-dbt-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-gooddata-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/gooddata/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-gooddata-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/gooddata/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-gooddata-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-honeydew-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/honeydew/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-honeydew-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/honeydew/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-honeydew-ci.yml'

jobs:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/converter-microsoft-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/microsoft/**'
- 'core-spec/ossie-schema.json'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-microsoft-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/microsoft/**'
- 'core-spec/ossie-schema.json'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-microsoft-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-nvidia-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/nvidia/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-nvidia-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/nvidia/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-nvidia-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-omni-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/omni/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-omni-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/omni/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-omni-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-ontology-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/ontology/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-ontology-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/ontology/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-ontology-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-orionbelt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/orionbelt/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-orionbelt-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/orionbelt/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-orionbelt-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-polaris-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/polaris/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-polaris-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/polaris/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-polaris-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-salesforce-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/salesforce/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-salesforce-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/salesforce/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-salesforce-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-sigma-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ on:
branches: [ "main" ]
paths:
- 'converters/sigma/**'
- 'core-spec/**'
- 'examples/**'
- 'python/**'
- '.github/workflows/converter-sigma-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/sigma/**'
- 'core-spec/**'
- 'examples/**'
- 'python/**'
- '.github/workflows/converter-sigma-ci.yml'

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-snowflake-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/snowflake/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-snowflake-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/snowflake/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-snowflake-ci.yml'

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/converter-wisdom-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ on:
branches: [ "main" ]
paths:
- 'converters/wisdom/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-wisdom-ci.yml'
pull_request:
branches: [ "main" ]
paths:
- 'converters/wisdom/**'
- 'core-spec/**'
- 'examples/**'
- '.github/workflows/converter-wisdom-ci.yml'

permissions:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/validation-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ on:
branches: ["main"]
paths:
- "validation/**"
- "python/**"
- "core-spec/**"
- "examples/tpcds_semantic_model.yaml"
- ".github/workflows/validation-ci.yml"
pull_request:
branches: ["main"]
paths:
- "validation/**"
- "python/**"
- "core-spec/**"
- "examples/tpcds_semantic_model.yaml"
- ".github/workflows/validation-ci.yml"
Expand Down Expand Up @@ -62,5 +64,8 @@ jobs:
- name: Run validation pytest tests
run: uv run --with pytest --with pyyaml --with jsonschema -m pytest validation/tests/

- name: Run shared Python model tests
run: uv run --with pytest --with jsonschema --with ./python -m pytest python/tests/

- name: Validate canonical example
run: uv run validation/validate.py examples/tpcds_semantic_model.yaml
10 changes: 10 additions & 0 deletions converters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@

# Apache Ossie Converters

## Document format

Converters use the flat `0.2.0.dev0` core format: one model per JSON/YAML document,
with `name`, `datasets`, `relationships`, and `metrics` at the root alongside
`version`. Legacy `semantic_model` arrays or object wrappers must be migrated
before conversion; see the [migration guidance](../core-spec/spec.md#migrating-earlier-document-shapes).
For catalog exports, write separate documents rather than wrapping multiple
models in one file. Ontology documents retain their embedded `semantic_model`
property as defined by the ontology schema.

## Overview

An Ossie Converter translates between the Ossie semantic model format and a specific vendor's semantic implementation. This enables teams to author a semantic model once in the Ossie standard and then generate the corresponding vendor-specific representation automatically.
Expand Down
6 changes: 5 additions & 1 deletion converters/databricks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Metric View only features (filter, window, format, rely, ...) are instead **pres
[requirement](#requirements) **raises a `ConversionError`** -- the converter never
silently drops a field or produces an invalid result.

Ossie documents contain one model directly at the root, with `version`, `name`,
`datasets`, and optional model properties. Legacy `semantic_model` wrappers
(arrays or objects) are rejected.

## Installation

```bash
Expand Down Expand Up @@ -77,7 +81,7 @@ Each row maps in both directions; the **Notes** flag where a behavior is specifi

| Apache Ossie | Metric View (v1.1) | Notes |
|---|---|---|
| `semantic_model.description` | `comment` | Model-level description only. |
| `description` | `comment` | Model-level description only. |
| root dataset | `source` | The fact/grain. |
| other `datasets` | nested `joins[]` | Export: the relationship graph is reassembled into the join tree; a dataset reached by two paths (a diamond) fans out into one aliased join per path. |
| `relationship` `from_columns`/`to_columns` | join `on` (differing names) / `using` (shared names) | Decomposed into columns on import; rebuilt into `on`/`using` on export. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def convert_metric_view_to_ossie(mv_yaml_str, model_name=None):
)

model = _convert_view(view, model_name)
return dump_yaml({"version": OSSIE_VERSION, "semantic_model": [model]})
return dump_yaml({"version": OSSIE_VERSION, **model})


def _convert_view(view, model_name):
Expand Down
17 changes: 11 additions & 6 deletions converters/databricks/src/ossie_databricks/ossie_to_metric_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,18 @@ def convert_ossie_to_metric_view(ossie_yaml_str, source=None):
f"Unsupported Apache Ossie version '{version}'. Supported: {OSSIE_VERSION}"
)

models = root.get("semantic_model")
if not isinstance(models, list) or not models:
raise ConversionError("'semantic_model' must be a non-empty list")
if len(models) > 1:
_warn("model", "multiple semantic models found; converting only the first")
if "semantic_model" in root:
raise ConversionError(
"Legacy 'semantic_model' wrappers are not supported; "
"place the model properties directly at the document root"
)
Comment thread
flyrain marked this conversation as resolved.

if "dialects" in root or "vendors" in root:
raise ConversionError("Root dialects and vendors are not supported by the Ossie spec")
if not isinstance(root.get("name"), str):
raise ConversionError("Ossie model requires a string 'name' at the document root")

view = _convert_model(models[0], explicit_source=source)
view = _convert_model(root, explicit_source=source)
return dump_yaml(view)


Expand Down
4 changes: 2 additions & 2 deletions converters/databricks/tests/_roundtrip_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def build_ossie(rnd):
model["relationships"] = relationships
if metrics:
model["metrics"] = metrics
return {"version": OSSIE_VERSION, "semantic_model": [model]}
return {"version": OSSIE_VERSION, **model}


def _three_part(rnd):
Expand Down Expand Up @@ -348,7 +348,7 @@ def assert_ossie_roundtrip(ossie):
mv_yaml = _convert(exporter.convert_ossie_to_metric_view, dump_yaml(ossie))
ossie2 = load_yaml(_convert(importer.convert_metric_view_to_ossie, mv_yaml))

m1, m2 = ossie["semantic_model"][0], ossie2["semantic_model"][0]
m1, m2 = ossie, ossie2
assert ({d["name"]: (d["source"], _fields_map(d)) for d in m1["datasets"]}
== {d["name"]: (d["source"], _fields_map(d)) for d in m2["datasets"]}), "datasets"
assert _rel_set(m1) == _rel_set(m2), "relationships"
Expand Down
18 changes: 9 additions & 9 deletions converters/databricks/tests/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ def strip_dropped(ossie):
`rely.at_most_one_match` (MV) -> `unique_keys` + a relationship rely-stash. We drop
both key forms and the relationship stash so the key info is compared as 'gone'."""
ossie = copy.deepcopy(ossie)
for model in ossie.get("semantic_model", []):
model.pop("name", None) # MV carries no model name
model.pop("description", None) # model + fact descriptions merge into one comment
for ds in model.get("datasets", []):
ds.pop("primary_key", None)
ds.pop("unique_keys", None)
ds.pop("description", None) # no per-source comment in single-source MV
for rel in model.get("relationships", []):
rel.pop("custom_extensions", None) # derived rely-stash from a declared key
model = ossie
model.pop("name", None) # MV carries no model name
model.pop("description", None) # model + fact descriptions merge into one comment
for ds in model.get("datasets", []):
ds.pop("primary_key", None)
ds.pop("unique_keys", None)
ds.pop("description", None) # no per-source comment in single-source MV
for rel in model.get("relationships", []):
rel.pop("custom_extensions", None) # derived rely-stash from a declared key
return ossie
Loading
Loading