<?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: Delta live table not refreshing - window function in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/delta-live-table-not-refreshing-window-function/m-p/79261#M35715</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110610"&gt;@ibrar_aslam&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for reaching out to our community! We're here to help you.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To ensure we provide you with the best support, could you please take a moment to review the response and choose the one that best answers your question? Your feedback not only helps us assist you better but also benefits other community members who may have similar questions in the future.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you found the answer helpful, consider giving it a kudo. If the response fully addresses your question, please mark it as the accepted solution. This will help us close the thread and ensure your question is resolved.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We appreciate your participation and are here to assist you further if you need it!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Rishabh&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jul 2024 15:11:37 GMT</pubDate>
    <dc:creator>RishabhTiwari07</dc:creator>
    <dc:date>2024-07-18T15:11:37Z</dc:date>
    <item>
      <title>Delta live table not refreshing - window function</title>
      <link>https://community.databricks.com/t5/data-engineering/delta-live-table-not-refreshing-window-function/m-p/76909#M35358</link>
      <description>&lt;P&gt;We have a list of streaming tables populated by Autoloader from files on S3, which serve as sources for our live tables. After the Autoloader Delta pipeline completes, we trigger a second Delta Live Tables (DLT) pipeline to perform a deduplication operation.&lt;/P&gt;&lt;P&gt;Our current deduplication process computes the rank of the latest record and filters based on this rank. However, we encounter an issue where we need to recreate the schema every time to update the live table, and even a full refresh doesn't resolve the problem.&lt;/P&gt;&lt;P&gt;Could anyone suggest best practices or optimizations for the deduplication process within Delta Live Tables? Additionally, how can we address the need to recreate the schema every time to ensure our live tables are correctly updated?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def generate_live_table(live_table_name: str, table_name: str, id_coll: str, spark: SparkSession) -&amp;gt; None:
    """Create or refresh Delta live table
    Args:
        live_table_name: live DLT name
        full_table_name: base table name
        full_table_schema: table schema
        id_coll: object ID column to partition by
        spark: spark session
    """

    .table(name=live_table_name, table_properties={"delta.columnMapping.mode": "name", "delta.minReaderVersion": "2", "delta.minWriterVersion": "5"})
    def create_or_refresh_live_table():
        return spark.sql(
            f"""
                SELECT * 
                FROM (Select *, rank() OVER (PARTITION BY `{id_coll}` ORDER BY installment_date DESC) as row_rank FROM {table_name})
                WHERE row_rank == 1  
        """
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 14:29:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/delta-live-table-not-refreshing-window-function/m-p/76909#M35358</guid>
      <dc:creator>ibrar_aslam</dc:creator>
      <dc:date>2024-07-05T14:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Delta live table not refreshing - window function</title>
      <link>https://community.databricks.com/t5/data-engineering/delta-live-table-not-refreshing-window-function/m-p/79261#M35715</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110610"&gt;@ibrar_aslam&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for reaching out to our community! We're here to help you.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To ensure we provide you with the best support, could you please take a moment to review the response and choose the one that best answers your question? Your feedback not only helps us assist you better but also benefits other community members who may have similar questions in the future.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you found the answer helpful, consider giving it a kudo. If the response fully addresses your question, please mark it as the accepted solution. This will help us close the thread and ensure your question is resolved.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We appreciate your participation and are here to assist you further if you need it!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Rishabh&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 15:11:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/delta-live-table-not-refreshing-window-function/m-p/79261#M35715</guid>
      <dc:creator>RishabhTiwari07</dc:creator>
      <dc:date>2024-07-18T15:11:37Z</dc:date>
    </item>
  </channel>
</rss>

