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
- 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
- Import:
ossie-databricks import -i view.yaml -o model.yaml
- Export:
ossie-databricks export -i model.yaml -o view_out.yaml
- 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
- 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).
- Read it back from stash in
_convert_metric in ossie_to_metric_view.py and emit display_name.
A Metric View measure with a
display_nameloses it after import. The field is silently dropped on import and never restored on export.Steps to reproduce
display_name:ossie-databricks import -i view.yaml -o model.yamlossie-databricks export -i model.yaml -o view_out.yamldisplay_nameis absent fromview_out.yaml.Root cause
display_nameis handled for dimensions but not measures.Import (
metric_view_to_ossie.py,_convert_measure):display_nameis never read — compare with_convert_dimensionwhich maps it to thelabelfield.Export (
ossie_to_metric_view.py,_convert_metric):labelis never written back todisplay_name— compare with_convert_fieldwhich does this correctly.Additionally,
labelis not part of theMetricschema (onlyFieldhas it), sodisplay_nameon a measure cannot map to a native Ossie field. It should be stashed incustom_extensions[DATABRICKS](same pattern asformat/window) so it survives the round-trip.Expected behaviour
display_nameon a measure is preserved after import → export.Proposed fix
display_nameto a measure-specific stash key tuple inmetric_view_to_ossie.py(separate from_COLUMN_STASH_KEYSto avoid double-stashing it for dimensions, where it already maps tolabel)._convert_metricinossie_to_metric_view.pyand emitdisplay_name.