Skip to content

Databricks converter drops display_name on measures during round-trip #326

Description

@GMorrisXBL

A Metric View measure with a display_name loses it after import. The field is silently dropped on import and never restored on export.

Steps to reproduce

  1. Create a Metric View YAML with a measure that has display_name:
    version: "1.1"
    source: catalog.schema.fact_table
    measures:
      - name: total_revenue
        expr: SUM(amount)
        display_name: Total Revenue
  2. Import: ossie-databricks import -i view.yaml -o model.yaml
  3. Export: ossie-databricks export -i model.yaml -o view_out.yaml
  4. Observe display_name is absent from view_out.yaml.

Root cause

display_name is handled for dimensions but not measures.

Import (metric_view_to_ossie.py, _convert_measure): display_name is never read — compare with _convert_dimension which maps it to the label field.

Export (ossie_to_metric_view.py, _convert_metric): label is never written back to display_name — compare with _convert_field which does this correctly.

Additionally, label is not part of the Metric schema (only Field has it), so display_name on a measure cannot map to a native Ossie field. It should be stashed in custom_extensions[DATABRICKS] (same pattern as format/window) so it survives the round-trip.

Expected behaviour

display_name on a measure is preserved after import → export.

Proposed fix

  1. Add display_name to a measure-specific stash key tuple in metric_view_to_ossie.py (separate from _COLUMN_STASH_KEYS to avoid double-stashing it for dimensions, where it already maps to label).
  2. Read it back from stash in _convert_metric in ossie_to_metric_view.py and emit display_name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions