Skip to content

Knowledge base: metric views#156

Open
lennartkats-db wants to merge 7 commits into
mainfrom
lennart.kats/knowledge-base-metric-views
Open

Knowledge base: metric views#156
lennartkats-db wants to merge 7 commits into
mainfrom
lennart.kats/knowledge-base-metric-views

Conversation

@lennartkats-db
Copy link
Copy Markdown
Contributor

Adds metric view examples to knowledge base: one based on a SQL job, one based on databricks-dbt.

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
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
@lennartkats-db lennartkats-db changed the title [DRAFT] Knowledge base: metric views Knowledge base: metric views May 28, 2026
Comment thread knowledge_base/metric_view/resources/bookings_kpis.job.yml Outdated
Comment thread knowledge_base/metric_view/databricks.yml Outdated
Comment thread knowledge_base/metric_view/databricks.yml Outdated
Comment thread knowledge_base/metric_view/databricks.yml Outdated
Comment thread knowledge_base/metric_view/databricks.yml Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/src/bookings_kpis.metric_view.sql Outdated
Comment thread knowledge_base/metric_view/databricks.yml Outdated
Comment thread knowledge_base/metric_view/databricks.yml Outdated
Comment thread knowledge_base/metric_view/databricks.yml Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view/README.md Outdated
Comment thread knowledge_base/metric_view_dbt/README.md Outdated
Comment thread knowledge_base/metric_view_dbt/README.md Outdated
Comment thread knowledge_base/metric_view_dbt/README.md Outdated
Comment thread knowledge_base/metric_view_dbt/README.md Outdated
Comment thread knowledge_base/metric_view_dbt/README.md
lennartkats-db and others added 2 commits May 30, 2026 10:22
Co-authored-by: Julia Crawford (Databricks) <julia.crawford@databricks.com>
Apply Julia's PR #156 inline suggestions (and parallel changes for the
metric_view_dbt variant) plus a few related cleanups surfaced by a
clean-context review:

- Drop the dbt-variant cross-link from metric_view/README.md (don't
  advertise dbt from the canonical example). Keep the inverse link.
- Drop the `workspace:` block (and prod root_path / permissions
  placeholders) from both databricks.yml — let the user's profile pin
  the host.
- Tighten databricks.yml comments: drop the dbt-PR/version reference,
  drop "Bundles do not yet support" staleness risk.
- Periods on variable descriptions.
- README structure: drop redundant subheaders, `## Get started` (not
  "Getting Started With This Project"), `## Learn more` (sentence case),
  `### Notes` instead of `## Advanced Topics`.
- Snippet matches query (no undefined fields), placeholder consistency
  (<catalog>.<your_schema>, no main.<your_schema> mix-up).
- Drop `aws/en/` from doc URLs (also in dbt model file).
- "Once registered" instead of "Once deployed" — accurate, matches
  Julia's suggestion.
- Unify prod schema across variants (dbt prod schema was `default`,
  SQL was `prod` — now both `prod`).
- Drop redundant "view integrates seamlessly with..." marketing line.
- Individual code blocks per command for easy copy-paste.

Co-authored-by: Isaac
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.

3 participants