Skip to content

Fix metric view YAML comment field ordering (#402)#445

Open
jacksandom wants to merge 1 commit intomainfrom
fix/metric-view-invalid-def
Open

Fix metric view YAML comment field ordering (#402)#445
jacksandom wants to merge 1 commit intomainfrom
fix/metric-view-invalid-def

Conversation

@jacksandom
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes METRIC_VIEW_INVALID_VIEW_DEFINITION error when creating metric views with a comment field
  • Swaps comment and source ordering in YAML generation and all documentation/test examples

Closes #402

Problem

_build_yaml_block() generated YAML with comment before source, but the Databricks parser expects source at index 1 (right after version). Any metric view created with a comment would fail with:

METRIC_VIEW_INVALID_VIEW_DEFINITION: Missing required creator property 'source' (index 1)

Changes

File Change
databricks-tools-core/.../unity_catalog/metric_views.py Swap source before comment in _build_yaml_block()
databricks-skills/databricks-metric-views/SKILL.md Fix 2 YAML examples
databricks-skills/databricks-metric-views/patterns.md Fix 4 YAML examples
.test/skills/databricks-metric-views/ground_truth.yaml Fix 5 expected YAML strings

Test plan

  • Verified generated YAML outputs version then source then comment ordering
  • Smoke tested metric view creation with comment on workspace
  • Grep confirmed no remaining top-level comment-before-source instances across all 4 files

@jacksandom jacksandom requested a review from calreynolds April 10, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

manage_metric_views: comment field ordering causes METRIC_VIEW_INVALID_VIEW_DEFINITION

1 participant