<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: can i deploy a metric view using DABs in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/can-i-deploy-a-metric-view-using-dabs/m-p/164063#M55220</link>
    <description>&lt;P&gt;Hi Areqio, You can use a &lt;STRONG&gt;SQL&lt;/STRONG&gt; file with Metric view definitions or &lt;STRONG&gt;Notebooks&lt;/STRONG&gt; with Metric view definitions as the standard path.&amp;nbsp;You can then wrap the SQL file or notebooks in a DABs &lt;STRONG&gt;job&lt;/STRONG&gt; resource using a &lt;STRONG&gt;sql file task &lt;/STRONG&gt;or &lt;STRONG&gt;notebook task&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;You can have the target catalog or schema as input variables and plan it to be environment aware (dev, staging, or prod).&amp;nbsp;You can pass the &lt;STRONG&gt;environment parameters&lt;/STRONG&gt; from the DAB config directly into the notebook as widgets, read them and use EXECUTE IMMEDIATE or other options to dynamically construct and execute the statements for the correct environment.&lt;/P&gt;&lt;P&gt;More details &lt;A href="https://community.databricks.com/t5/technical-blog/how-to-deploy-metric-views-with-dabs/ba-p/138432" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jul 2026 18:20:55 GMT</pubDate>
    <dc:creator>balajij8</dc:creator>
    <dc:date>2026-07-24T18:20:55Z</dc:date>
    <item>
      <title>can i deploy a metric view using DABs</title>
      <link>https://community.databricks.com/t5/data-engineering/can-i-deploy-a-metric-view-using-dabs/m-p/164061#M55219</link>
      <description>&lt;P&gt;I am trying to deploy metric view using DABs but I cant find a resource for it so i ended up with a SQL file but is there a way to automatically run the SQL for it&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2026 17:47:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-i-deploy-a-metric-view-using-dabs/m-p/164061#M55219</guid>
      <dc:creator>Areqio</dc:creator>
      <dc:date>2026-07-24T17:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: can i deploy a metric view using DABs</title>
      <link>https://community.databricks.com/t5/data-engineering/can-i-deploy-a-metric-view-using-dabs/m-p/164063#M55220</link>
      <description>&lt;P&gt;Hi Areqio, You can use a &lt;STRONG&gt;SQL&lt;/STRONG&gt; file with Metric view definitions or &lt;STRONG&gt;Notebooks&lt;/STRONG&gt; with Metric view definitions as the standard path.&amp;nbsp;You can then wrap the SQL file or notebooks in a DABs &lt;STRONG&gt;job&lt;/STRONG&gt; resource using a &lt;STRONG&gt;sql file task &lt;/STRONG&gt;or &lt;STRONG&gt;notebook task&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;You can have the target catalog or schema as input variables and plan it to be environment aware (dev, staging, or prod).&amp;nbsp;You can pass the &lt;STRONG&gt;environment parameters&lt;/STRONG&gt; from the DAB config directly into the notebook as widgets, read them and use EXECUTE IMMEDIATE or other options to dynamically construct and execute the statements for the correct environment.&lt;/P&gt;&lt;P&gt;More details &lt;A href="https://community.databricks.com/t5/technical-blog/how-to-deploy-metric-views-with-dabs/ba-p/138432" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2026 18:20:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-i-deploy-a-metric-view-using-dabs/m-p/164063#M55220</guid>
      <dc:creator>balajij8</dc:creator>
      <dc:date>2026-07-24T18:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: can i deploy a metric view using DABs</title>
      <link>https://community.databricks.com/t5/data-engineering/can-i-deploy-a-metric-view-using-dabs/m-p/164096#M55229</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/220925"&gt;@Areqio&lt;/a&gt;&amp;nbsp;there is no metric view resource in Asset Bundles today. Your SQL file is the intended shape for anything the bundle doesn't model yet. The missing piece is a job that runs it, so deployment becomes deploy then run.&lt;/P&gt;&lt;P&gt;You can with just two scripts: a `databricks.yml` (or a resources file) and a job that executes your SQL on a warehouse and passes per-target values as parameters:&lt;/P&gt;&lt;P&gt;```yaml&lt;BR /&gt;variables:&lt;BR /&gt;warehouse_id:&lt;BR /&gt;catalog:&lt;BR /&gt;default: main&lt;BR /&gt;schema:&lt;BR /&gt;default: analytics&lt;/P&gt;&lt;P&gt;resources:&lt;BR /&gt;jobs:&lt;BR /&gt;metric_views_ddl:&lt;BR /&gt;name: deploy-metric-views-${bundle.target}&lt;BR /&gt;tasks:&lt;BR /&gt;- task_key: create_metric_view&lt;BR /&gt;sql_task:&lt;BR /&gt;file:&lt;BR /&gt;path: ./sql/metric_view.sql&lt;BR /&gt;warehouse_id: ${var.warehouse_id}&lt;BR /&gt;parameters:&lt;BR /&gt;catalog: ${var.catalog}&lt;BR /&gt;schema: ${var.schema}&lt;BR /&gt;```&lt;/P&gt;&lt;P&gt;And `sql/metric_view.sql`, as small as a metric view can be:&lt;/P&gt;&lt;P&gt;```sql&lt;BR /&gt;USE CATALOG IDENTIFIER(:catalog);&lt;BR /&gt;USE SCHEMA IDENTIFIER(:schema);&lt;/P&gt;&lt;P&gt;DECLARE OR REPLACE VARIABLE qry_str STRING;&lt;/P&gt;&lt;P&gt;SET VARIABLE qry_str = "&lt;BR /&gt;CREATE OR REPLACE VIEW metv_orders_minimal&lt;BR /&gt;WITH METRICS&lt;BR /&gt;LANGUAGE YAML&lt;BR /&gt;AS $$&lt;BR /&gt;version: 0.1&lt;/P&gt;&lt;P&gt;source: " || :catalog || "." || :schema || ".orders&lt;/P&gt;&lt;P&gt;dimensions:&lt;BR /&gt;- name: Order Date&lt;BR /&gt;expr: order_date&lt;/P&gt;&lt;P&gt;measures:&lt;BR /&gt;- name: Total Orders&lt;BR /&gt;expr: COUNT(1)&lt;BR /&gt;$$";&lt;/P&gt;&lt;P&gt;EXECUTE IMMEDIATE qry_str;&lt;BR /&gt;```&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For testing:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;```bash&lt;BR /&gt;databricks bundle deploy -t dev&lt;BR /&gt;databricks bundle run metric_views_ddl -t dev&lt;BR /&gt;```&lt;/P&gt;&lt;P&gt;Then confirm it behaves as a metric view:&lt;/P&gt;&lt;P&gt;```sql&lt;BR /&gt;SELECT `Order Date`, MEASURE(`Total Orders`) FROM metv_orders_minimal GROUP BY ALL;&lt;BR /&gt;```&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jul 2026 20:17:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-i-deploy-a-metric-view-using-dabs/m-p/164096#M55229</guid>
      <dc:creator>binlogreader</dc:creator>
      <dc:date>2026-07-25T20:17:31Z</dc:date>
    </item>
  </channel>
</rss>

