<?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 Changing a Delta Live Table's schema in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/changing-a-delta-live-table-s-schema/m-p/91607#M38220</link>
    <description>&lt;P&gt;I have a Delta Live Table whose source is a Kafka stream. One of the columns is a Decimal and I need to change its precision.&lt;/P&gt;&lt;P&gt;What's the correct approach to changing the DLT's schema?&lt;/P&gt;&lt;P&gt;Just changing the column's precision in the DLT definition will result in an error running the pipeline - the old and new columns are incompatible, even if it's the same type but a different precision. And the overwriteSchema/mergeSchema options are not valid for a Kafka stream.&lt;/P&gt;&lt;P&gt;My current options are:&lt;/P&gt;&lt;P&gt;- Deleting the DLT and letting the pipeline rebuild it&lt;/P&gt;&lt;P&gt;- Changing the DLT's column through ALTER TABLE&lt;/P&gt;</description>
    <pubDate>Tue, 24 Sep 2024 17:43:29 GMT</pubDate>
    <dc:creator>rcostanza</dc:creator>
    <dc:date>2024-09-24T17:43:29Z</dc:date>
    <item>
      <title>Changing a Delta Live Table's schema</title>
      <link>https://community.databricks.com/t5/data-engineering/changing-a-delta-live-table-s-schema/m-p/91607#M38220</link>
      <description>&lt;P&gt;I have a Delta Live Table whose source is a Kafka stream. One of the columns is a Decimal and I need to change its precision.&lt;/P&gt;&lt;P&gt;What's the correct approach to changing the DLT's schema?&lt;/P&gt;&lt;P&gt;Just changing the column's precision in the DLT definition will result in an error running the pipeline - the old and new columns are incompatible, even if it's the same type but a different precision. And the overwriteSchema/mergeSchema options are not valid for a Kafka stream.&lt;/P&gt;&lt;P&gt;My current options are:&lt;/P&gt;&lt;P&gt;- Deleting the DLT and letting the pipeline rebuild it&lt;/P&gt;&lt;P&gt;- Changing the DLT's column through ALTER TABLE&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 17:43:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/changing-a-delta-live-table-s-schema/m-p/91607#M38220</guid>
      <dc:creator>rcostanza</dc:creator>
      <dc:date>2024-09-24T17:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a Delta Live Table's schema</title>
      <link>https://community.databricks.com/t5/data-engineering/changing-a-delta-live-table-s-schema/m-p/101167#M40571</link>
      <description>&lt;P&gt;To change the precision of a Decimal column in a Delta Live Table (DLT) with a Kafka stream source, you can follow these steps:&lt;/P&gt;
&lt;P&gt;1. Create a new column in the DLT with the desired precision.&lt;BR /&gt;2. Copy the data from the old column to the new column.&lt;BR /&gt;3. Drop the old column.&lt;BR /&gt;4. Rename the new column to the original column name.&lt;/P&gt;
&lt;P&gt;Here's an example of how to do this using SQL:&lt;/P&gt;
&lt;P&gt;```sql&lt;BR /&gt;-- Create a new column with the desired precision&lt;BR /&gt;ALTER TABLE your_table_name ADD COLUMNS (new_column Decimal(precision, scale));&lt;/P&gt;
&lt;P&gt;-- Copy the data from the old column to the new column&lt;BR /&gt;UPDATE your_table_name SET new_column = old_column;&lt;/P&gt;
&lt;P&gt;-- Drop the old column&lt;BR /&gt;ALTER TABLE your_table_name DROP COLUMN old_column;&lt;/P&gt;
&lt;P&gt;-- Rename the new column to the original column name&lt;BR /&gt;ALTER TABLE your_table_name CHANGE COLUMN new_column old_column Decimal(precision, scale);&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;Replace `your_table_name` with the name of your DLT, `old_column` with the name of the column you want to change, `new_column` with a temporary name for the new column, and `precision` and `scale` with the desired precision and scale for the Decimal type.&lt;/P&gt;
&lt;P&gt;This approach allows you to change the precision of the column without deleting the DLT or using the `overwriteSchema` or `mergeSchema` options.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 06:38:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/changing-a-delta-live-table-s-schema/m-p/101167#M40571</guid>
      <dc:creator>Sidhant07</dc:creator>
      <dc:date>2024-12-06T06:38:17Z</dc:date>
    </item>
  </channel>
</rss>

