<?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: Title: How to handle type widening (int→bigint) in DLT streaming tables without dropping the tab in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/title-how-to-handle-type-widening-int-bigint-in-dlt-streaming/m-p/142618#M51983</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/151454"&gt;@hnnhhnnh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DLT streaming tables that use apply changes do not support widening the data type of key columns such as changing an integer to a bigint after the table is created. Even though Delta and Unity Catalog support type widening in general, DLT streaming with apply changes requires a stable schema for key columns and will fail on such changes. This is why both incremental runs and full refresh fail. schemaTrackingLocation is not supported inside DLT views and is only available in standard Structured Streaming outside DLT. The recommended approach in production is to avoid type changes on key columns in streaming DLT pipelines, introduce a new column with the widened type and migrate downstream usage, or rebuild the target table when such a change is required.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Dec 2025 09:20:48 GMT</pubDate>
    <dc:creator>mukul1409</dc:creator>
    <dc:date>2025-12-29T09:20:48Z</dc:date>
    <item>
      <title>Title: How to handle type widening (int→bigint) in DLT streaming tables without dropping the table</title>
      <link>https://community.databricks.com/t5/data-engineering/title-how-to-handle-type-widening-int-bigint-in-dlt-streaming/m-p/142603#M51979</link>
      <description>&lt;P&gt;Setup&lt;BR /&gt;Bronze source table (external to DLT, CDF &amp;amp; type widening enabled):&lt;/P&gt;&lt;P&gt;# Source table properties:&lt;BR /&gt;# delta.enableChangeDataFeed: "true"&lt;BR /&gt;# delta.enableDeletionVectors: "true"&lt;BR /&gt;# delta.enableTypeWidening: "true"&lt;BR /&gt;# delta.minReaderVersion: "3"&lt;BR /&gt;# delta.minWriterVersion: "7"&lt;/P&gt;&lt;P&gt;# Type widening applied:&lt;BR /&gt;spark.sql("ALTER TABLE cat_dev.poc.source_data ALTER COLUMN id TYPE BIGINT")&lt;BR /&gt;DLT Pipeline notebook:&lt;/P&gt;&lt;P&gt;import dlt&lt;BR /&gt;from pyspark.sql import functions as F&lt;/P&gt;&lt;P&gt;CATALOG = spark.conf.get("catalog", "test_catalog")&lt;BR /&gt;SOURCE_SCHEMA = "poc_schema_evolution"&lt;BR /&gt;SOURCE_TABLE = "source_data"&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/97035"&gt;@Dlt&lt;/a&gt;.view&lt;BR /&gt;def bronze_source():&lt;BR /&gt;"""Read source data as CDF streaming"""&lt;BR /&gt;return (&lt;BR /&gt;spark.readStream&lt;BR /&gt;.format("delta")&lt;BR /&gt;.option("readChangeFeed", "true")&lt;BR /&gt;.table(f"{CATALOG}.{SOURCE_SCHEMA}.{SOURCE_TABLE}")&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;dlt.create_streaming_table(&lt;BR /&gt;name="silver_person",&lt;BR /&gt;comment="Silver person table - POC for schema evolution",&lt;BR /&gt;table_properties={&lt;BR /&gt;"delta.minReaderVersion": "3",&lt;BR /&gt;"delta.minWriterVersion": "7",&lt;BR /&gt;"pipelines.typeWideningAvailable": "true",&lt;BR /&gt;"pipelines.enableTypeWidening": "true",&lt;BR /&gt;"delta.columnMapping.mode": "name",&lt;BR /&gt;"delta.enableDeletionVectors": "true",&lt;BR /&gt;"delta.enableChangeDataFeed": "true",&lt;BR /&gt;"delta.autoOptimize.autoCompact": "true",&lt;BR /&gt;"delta.autoOptimize.optimizeWrite": "true",&lt;BR /&gt;"pipelines.reset.allowed": "false",&lt;BR /&gt;}&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;dlt.apply_changes(&lt;BR /&gt;target="silver_person",&lt;BR /&gt;source="bronze_source",&lt;BR /&gt;keys=["id"],&lt;BR /&gt;sequence_by=F.col("load_dts"),&lt;BR /&gt;stored_as_scd_type=1,&lt;BR /&gt;except_column_list=["_change_type", "_commit_version", "_commit_timestamp"],&lt;BR /&gt;)&lt;BR /&gt;Pipeline configuration (databricks.yml):&lt;/P&gt;&lt;P&gt;configuration:&lt;BR /&gt;catalog: ${var.catalog}&lt;BR /&gt;"spark.databricks.delta.streaming.skipChangeCommits": "true"&lt;BR /&gt;"pipelines.enableTypeWidening": "true"&lt;BR /&gt;"spark.databricks.delta.streaming.allowSourceColumnTypeChange": "true"&lt;BR /&gt;Verified Table Properties&lt;BR /&gt;Silver table (after creation):&lt;/P&gt;&lt;P&gt;delta.autoOptimize.autoCompact: "true"&lt;BR /&gt;delta.autoOptimize.optimizeWrite: "true"&lt;BR /&gt;delta.columnMapping.mode: "name"&lt;BR /&gt;delta.enableChangeDataFeed: "true"&lt;BR /&gt;delta.enableDeletionVectors: "true"&lt;BR /&gt;pipelines.enableTypeWidening: "true"&lt;BR /&gt;pipelines.typeWideningAvailable: "true"&lt;BR /&gt;pipelines.reset.allowed: "false"&lt;BR /&gt;Error&lt;BR /&gt;After several successful runs with INT id column, I widened the source table's id column from INT to BIGINT. The DLT pipeline fails with:&lt;/P&gt;&lt;P&gt;[CANNOT_UPDATE_TABLE_SCHEMA] Failed to merge the current and new schemas for table silver_person.&lt;BR /&gt;To proceed with this schema change, you can trigger a full refresh of this table.&lt;/P&gt;&lt;P&gt;[DELTA_FAILED_TO_MERGE_FIELDS] Failed to merge fields 'id' and 'id'&lt;BR /&gt;[DELTA_MERGE_INCOMPATIBLE_DATATYPE] Failed to merge incompatible data types IntegerType and LongType&lt;BR /&gt;Full refresh also fails with the same error (even with pipelines.reset.allowed temporarily set to true).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;schemaTrackingLocation Tried in readStream &lt;span class="lia-unicode-emoji" title=":cross_mark:"&gt;❌&lt;/span&gt; Error: must be under DLT checkpoint&lt;BR /&gt;Questions&lt;BR /&gt;Is there a way to handle type widening (INT→BIGINT) in DLT streaming tables with apply_changes without dropping the target table?&lt;BR /&gt;Does type widening with schema evolution work for DLT streaming tables, or is it only supported for batch/merge operations?&lt;BR /&gt;Is schemaTrackingLocation supported in &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/97035"&gt;@Dlt&lt;/a&gt;.view, or only in regular Structured Streaming outside DLT?&lt;BR /&gt;What is the recommended pattern for handling upstream type changes in production DLT pipelines?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2025 04:11:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/title-how-to-handle-type-widening-int-bigint-in-dlt-streaming/m-p/142603#M51979</guid>
      <dc:creator>hnnhhnnh</dc:creator>
      <dc:date>2025-12-29T04:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Title: How to handle type widening (int→bigint) in DLT streaming tables without dropping the tab</title>
      <link>https://community.databricks.com/t5/data-engineering/title-how-to-handle-type-widening-int-bigint-in-dlt-streaming/m-p/142618#M51983</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/151454"&gt;@hnnhhnnh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DLT streaming tables that use apply changes do not support widening the data type of key columns such as changing an integer to a bigint after the table is created. Even though Delta and Unity Catalog support type widening in general, DLT streaming with apply changes requires a stable schema for key columns and will fail on such changes. This is why both incremental runs and full refresh fail. schemaTrackingLocation is not supported inside DLT views and is only available in standard Structured Streaming outside DLT. The recommended approach in production is to avoid type changes on key columns in streaming DLT pipelines, introduce a new column with the widened type and migrate downstream usage, or rebuild the target table when such a change is required.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2025 09:20:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/title-how-to-handle-type-widening-int-bigint-in-dlt-streaming/m-p/142618#M51983</guid>
      <dc:creator>mukul1409</dc:creator>
      <dc:date>2025-12-29T09:20:48Z</dc:date>
    </item>
  </channel>
</rss>

