<?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: Validation with views - Dlt pipeline expectations in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122270#M46721</link>
    <description>&lt;P&gt;@&lt;A class="" href="https://community.databricks.com/t5/user/viewprofilepage/user-id/102399" target="_self"&gt;&lt;SPAN class=""&gt;ilir_nuredini&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;It totally makes sense. Thanks to confirm it. I would say that the best way to validate tables with expectations would be to use &lt;STRONG&gt;p&lt;SPAN&gt;rivate&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;materialized&lt;/STRONG&gt; views and not views as it suggested in the link.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note. Private&amp;nbsp;materialized views were previously created with the&amp;nbsp;TEMPORARY&amp;nbsp;parameter).&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/dlt-ref/dlt-sql-ref-create-materialized-view" target="_blank" rel="noopener"&gt;CREATE MATERIALIZED VIEW (Lakeflow Declarative Pipelines) | Databricks Documentation&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jun 2025 15:19:16 GMT</pubDate>
    <dc:creator>lucami</dc:creator>
    <dc:date>2025-06-19T15:19:16Z</dc:date>
    <item>
      <title>Validation with views - Dlt pipeline expectations</title>
      <link>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122248#M46714</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have a question about how expectations work when applied to views inside a Delta Live Tables (DLT) pipeline. For instance, suppose we define this view inside a pipeline to stop the pipeline if we spot some duplicates:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/97035"&gt;@Dlt&lt;/a&gt;.view(
    name=view_name,
)
@dlt.expect_or_fail(expectation, "duplicate = 1")
def generate_report():
    return (
        dlt.read(table)
        .groupBy(keys)
        .agg(count("*").alias("duplicate"))
    )&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;What is happening behind the scenes? Is the expectation validated as a "temporary table" (computed but not stored in the catalog), or is it validated only if the view is used by a table defined in the pipeline?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jun 2025 13:05:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122248#M46714</guid>
      <dc:creator>lucami</dc:creator>
      <dc:date>2025-06-19T13:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Validation with views - Dlt pipeline expectations</title>
      <link>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122267#M46719</link>
      <description>&lt;P&gt;Also noticed that in&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/dlt/expectation-patterns?language=Python" target="_blank" rel="noopener"&gt;Expectation recommendations and advanced patterns | Databricks Documentation&lt;/A&gt;, it is suggested to use&lt;I&gt; &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/97035"&gt;@Dlt&lt;/a&gt;.view&amp;nbsp;&lt;/I&gt;with Python and &lt;EM&gt;CREATE OR REFRESH MATERIALIZED VIEW&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;with SQL, which&amp;nbsp;&lt;SPAN&gt;confuses me...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jun 2025 14:58:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122267#M46719</guid>
      <dc:creator>lucami</dc:creator>
      <dc:date>2025-06-19T14:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Validation with views - Dlt pipeline expectations</title>
      <link>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122268#M46720</link>
      <description>&lt;P&gt;Hello mai_luca&lt;/P&gt;&lt;P&gt;The expectation in your &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/97035"&gt;@Dlt&lt;/a&gt;.expect_or_fail() is only evaluated if the view is used downstream by a materialized table. If the view is only referenced by another view, or not used at all, the expectation will not be evaluated. DLT will not materialize the view, and the check will be skipped entirely.&lt;/P&gt;&lt;P&gt;Behind the scenes, here's what happens:&lt;/P&gt;&lt;P&gt;1. Views in DLT are logical constructs. They are not stored in the metastore or physically persisted.&lt;/P&gt;&lt;P&gt;2. DLT evaluates views lazily. This means a view is only computed if it is referenced by something downstream, such as a table.&lt;/P&gt;&lt;P&gt;3. If an expectation is attached to a view, it is only applied when that view is actually evaluated.&lt;/P&gt;&lt;P&gt;So, if no downstream &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/97035"&gt;@Dlt&lt;/a&gt;.table consumes 'view_name', the expectation will not run, and the pipeline will not fail, even if the data violates the condition.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Ilir&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jun 2025 15:02:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122268#M46720</guid>
      <dc:creator>ilir_nuredini</dc:creator>
      <dc:date>2025-06-19T15:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Validation with views - Dlt pipeline expectations</title>
      <link>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122270#M46721</link>
      <description>&lt;P&gt;@&lt;A class="" href="https://community.databricks.com/t5/user/viewprofilepage/user-id/102399" target="_self"&gt;&lt;SPAN class=""&gt;ilir_nuredini&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;It totally makes sense. Thanks to confirm it. I would say that the best way to validate tables with expectations would be to use &lt;STRONG&gt;p&lt;SPAN&gt;rivate&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;materialized&lt;/STRONG&gt; views and not views as it suggested in the link.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note. Private&amp;nbsp;materialized views were previously created with the&amp;nbsp;TEMPORARY&amp;nbsp;parameter).&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/dlt-ref/dlt-sql-ref-create-materialized-view" target="_blank" rel="noopener"&gt;CREATE MATERIALIZED VIEW (Lakeflow Declarative Pipelines) | Databricks Documentation&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jun 2025 15:19:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122270#M46721</guid>
      <dc:creator>lucami</dc:creator>
      <dc:date>2025-06-19T15:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Validation with views - Dlt pipeline expectations</title>
      <link>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122271#M46722</link>
      <description>&lt;P&gt;That is right, and thank you. It would be great if you can mark as the right answer the reply solution so future colleagues can have this article as their reference. Best, Ilir&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jun 2025 15:26:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122271#M46722</guid>
      <dc:creator>ilir_nuredini</dc:creator>
      <dc:date>2025-06-19T15:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Validation with views - Dlt pipeline expectations</title>
      <link>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122273#M46723</link>
      <description>&lt;P&gt;In DLT, expectations defined with dlt.expect_or_fail() on views are only evaluated if the view is used downstream by a materialized table. Since views are logical and lazily evaluated, if no table depends on the view, the expectation is skipped and the pipeline won’t fail—even if the data violates the condition.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jun 2025 16:38:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/validation-with-views-dlt-pipeline-expectations/m-p/122273#M46723</guid>
      <dc:creator>Yogesh_Verma_</dc:creator>
      <dc:date>2025-06-19T16:38:22Z</dc:date>
    </item>
  </channel>
</rss>

