Knowledge base: metric views#156
Open
lennartkats-db wants to merge 6 commits into
Open
Conversation
Two parallel knowledge_base demos for creating a Unity Catalog Metric View from a bundle: - knowledge_base/metric_view/ — minimal sql_task-in-a-job pattern that runs CREATE OR REPLACE VIEW ... WITH METRICS LANGUAGE YAML against a SQL warehouse. - knowledge_base/metric_view-dbt/ — dbt-databricks 1.12.0+ variant using the new `metric_view` materialization (dbt-databricks PR #1285). Both define bookings_kpis over samples.wanderbricks.bookings and were verified end-to-end on a real workspace (17,948 bookings / $9.9M revenue). Co-authored-by: Isaac
…consistency Co-authored-by: Isaac
Co-authored-by: Isaac
From a fresh-user walkthrough of both metric_view examples: - Add `CREATE SCHEMA IF NOT EXISTS` to the SQL variant so the example works even when the target schema doesn't pre-exist (the dbt variant already handles this via the adapter). - Mention the `host: https://company.databricks.com` placeholder in both READMEs' Getting started — previously a silent first-time-user trap. - Note that the default `catalog: main` is often not writable; flag this in the Getting started for both variants. - Align the YAML body with the official docs: - bump version 0.1 → 1.0 - drop the redundant `status` dimension (the filter already pins it) - drop outer quotes on `filter:` - add `comment:` at the metric view level and on each measure - Soften the DBR / wrapper-internals claims in both READMEs to match what the docs actually guarantee. - Drop the misleading "serverless" qualifier on the warehouse placeholder. Co-authored-by: Isaac
- Both jobs gain a `trigger: periodic: {interval: 1, unit: DAYS}` so the
view definition is re-applied daily in production. mode: development
auto-pauses the trigger; only fires after `bundle deploy --target prod`.
- Restructure both READMEs to match the udtf-operator shape:
Concrete Example (Definition + SQL Usage), Getting Started
(Prerequisites / Setup / Deployment for dev and prod), Advanced Topics,
Learn More.
- Link Advanced Topics' scheduling note to the deployment-modes docs.
Co-authored-by: Isaac
pietern
approved these changes
May 28, 2026
Comment on lines
+33
to
+34
| workspace: | ||
| host: https://company.databricks.com |
Contributor
There was a problem hiding this comment.
I would take workspace out completely from the example
| - Databricks SQL dashboards / AI/BI Genie | ||
| - Any BI tool that connects to your workspace | ||
|
|
||
| ## Getting Started With This Project |
Contributor
There was a problem hiding this comment.
Suggested change
| ## Getting Started With This Project | |
| ## Get started |
Contributor
There was a problem hiding this comment.
Actually is all of this Get started? Seems like it's just Usage?
|
|
||
| **Learn more:** [Unity Catalog Metric Views](https://docs.databricks.com/aws/en/metric-views/) · dbt-based variant: [`../metric_view_dbt`](../metric_view_dbt) | ||
|
|
||
| ## Concrete example: Definition and Usage |
Contributor
There was a problem hiding this comment.
Suggested change
| ## Concrete example: Definition and Usage |
This is a little weird - I'd probably get rid of this, and just make the edit i suggest below so there is one section that describe the metric view.
|
|
||
| `{{catalog}}` and `{{schema}}` in the SQL file are substituted from job parameters at run time. | ||
|
|
||
| ### SQL Usage |
Contributor
There was a problem hiding this comment.
Suggested change
| ### SQL Usage |
Seems unnecessary since it is still describing the metric view
|
|
||
| The metric view will be created at `<catalog>.<your_username>.bookings_kpis` (dev) or `<catalog>.default.bookings_kpis` (prod). | ||
|
|
||
| ## Advanced Topics |
Contributor
There was a problem hiding this comment.
Same comments as in the other README.md
Contributor
There was a problem hiding this comment.
Same comments as the other README.md above
Co-authored-by: Julia Crawford (Databricks) <julia.crawford@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds metric view examples to knowledge base: one based on a SQL job, one based on databricks-dbt.