<?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: How can i rename a column  in a delta table? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-can-i-rename-a-column-in-a-delta-table/m-p/167257#M55661</link>
    <description>&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/250070"&gt;@gowri_databrick&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Common Approaches are:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQL migration through PySpark:&lt;/STRONG&gt; This is only a Python wrapper around the same SQL DDL. It is not a different renaming mechanism. It needs the columnMapping.mode = 'name' to be enabled on the table first.&lt;/P&gt;&lt;PRE&gt;spark.sql("""
    ALTER TABLE catalog.schema.orders
    RENAME COLUMN order_dt TO order_date
""")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;DataFrame level rename:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;df = source_df.withColumnRenamed("old_name", "new_name")
or
df = source_df.select(col("old_name").alias("new_name"))&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;This changes only the DataFrame schema, not the existing Delta table. If metadata-based renaming is unavailable (In cases where it's Not possible to Enable Column Mapping Mode or to change the table protocol), the DataFrame must be written back using overwriteSchema=true, which generally rewrites the table.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Caveats :&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Column mapping makes a Delta column rename metadata-only, but downstream dependencies still need updating: views, jobs, constraints, dashboards, and data contracts.&lt;/LI&gt;&lt;LI&gt;Enabling column mapping upgrades the Delta protocol, typically to at least minReaderVersion = 2 and minWriterVersion = 5. It is effectively a one-way upgrade, so older Delta clients, external engines, or direct storage readers may no longer be compatible.&lt;/LI&gt;&lt;LI&gt;For &lt;STRONG&gt;changing the data type of an existing column&lt;/STRONG&gt;, the common pattern is to add a replacement column, backfill it, drop the original column, and rename the replacement.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Streaming-based&lt;/STRONG&gt; tables use persistent checkpoints. Schema changes must therefore be coordinated with the stream, do not casually delete or reset checkpoints. The stream may need to be stopped and restarted while preserving its checkpoint and progress.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;mergeSchema = true&lt;/STRONG&gt; supports additive schema evolution, but does not automatically make column renames safe.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Sep 2026 09:02:34 GMT</pubDate>
    <dc:creator>data_pulse</dc:creator>
    <dc:date>2026-09-02T09:02:34Z</dc:date>
    <item>
      <title>How can i rename a column  in a delta table?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-rename-a-column-in-a-delta-table/m-p/167250#M55658</link>
      <description>&lt;P&gt;I have a delta table and i want to rename one of its columns.&lt;/P&gt;&lt;P&gt;what is the recommended way to rename a column in databricks?&lt;/P&gt;&lt;P&gt;is there any difference between renaming a column using sql and using pyspark?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2026 07:06:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-rename-a-column-in-a-delta-table/m-p/167250#M55658</guid>
      <dc:creator>gowri_databrick</dc:creator>
      <dc:date>2026-09-02T07:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: How can i rename a column  in a delta table?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-rename-a-column-in-a-delta-table/m-p/167251#M55659</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/250070"&gt;@gowri_databrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do it seamlessly using a one-time metadata upgrade that decouples the logical column names from the physical files, turning the rename into a fast and metadata-only operation that avoids rewriting any underlying data files. You can enable column mapping upgrade and run the rename command using standard SQL&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ALTER TABLE workspace.files.files SET TBLPROPERTIES (
'delta.columnMapping.mode' = 'name',
'delta.minReaderVersion' = '2',
'delta.minWriterVersion' = '5'
);

-- Metadata-only column rename
ALTER TABLE workspace.files.files RENAME COLUMN files_old TO files_new;&lt;/LI-CODE&gt;&lt;P&gt;Both Pyspark and SQL renames execute the exact same underlying Delta Lake engine command. If the pipeline is in Python, wrap the identical statements inside spark sql and run the code.&lt;/P&gt;&lt;P&gt;Enabling column mapping mode is a permanent, one-way upgrade. Once the table properties are updated, legacy Delta Lake readers on protocol versions lower than reader version 2 will not be able to read the table.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2026 07:43:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-rename-a-column-in-a-delta-table/m-p/167251#M55659</guid>
      <dc:creator>balajij8</dc:creator>
      <dc:date>2026-09-02T07:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can i rename a column  in a delta table?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-rename-a-column-in-a-delta-table/m-p/167252#M55660</link>
      <description>&lt;P&gt;The recommended way to rename a column in Databricks Delta Lake is by enabling Delta Column Mapping.&lt;BR /&gt;Step 1: Enable Column Mapping&lt;BR /&gt;You can enable Column Mapping during table creation or alter an existing table:&lt;BR /&gt;ALTER TABLE catalog_name.schema_name.table_name SET TBLPROPERTIES ('delta.columnMapping.mode' = 'name');&lt;/P&gt;&lt;P&gt;Note: Once enabled, delta.columnMapping.mode cannot be downgraded back to none. Tables created with Databricks Runtime 10.2+ or Unity Catalog defaults often have this property pre-configured.&lt;/P&gt;&lt;P&gt;Step 2: Rename the Column&lt;BR /&gt;Once column mapping is enabled, you can rename the column using SQL or PySpark.&lt;BR /&gt;Using SQL (Recommended)&lt;BR /&gt;Executing a metadata-only rename via SQL is standard practice:&lt;BR /&gt;ALTER TABLE catalog_name.schema_name.table_name&lt;BR /&gt;RENAME COLUMN old_column_name TO new_column_name;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2026 07:45:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-rename-a-column-in-a-delta-table/m-p/167252#M55660</guid>
      <dc:creator>Satyasai</dc:creator>
      <dc:date>2026-09-02T07:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can i rename a column  in a delta table?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-rename-a-column-in-a-delta-table/m-p/167257#M55661</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/250070"&gt;@gowri_databrick&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Common Approaches are:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQL migration through PySpark:&lt;/STRONG&gt; This is only a Python wrapper around the same SQL DDL. It is not a different renaming mechanism. It needs the columnMapping.mode = 'name' to be enabled on the table first.&lt;/P&gt;&lt;PRE&gt;spark.sql("""
    ALTER TABLE catalog.schema.orders
    RENAME COLUMN order_dt TO order_date
""")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;DataFrame level rename:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;df = source_df.withColumnRenamed("old_name", "new_name")
or
df = source_df.select(col("old_name").alias("new_name"))&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;This changes only the DataFrame schema, not the existing Delta table. If metadata-based renaming is unavailable (In cases where it's Not possible to Enable Column Mapping Mode or to change the table protocol), the DataFrame must be written back using overwriteSchema=true, which generally rewrites the table.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Caveats :&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Column mapping makes a Delta column rename metadata-only, but downstream dependencies still need updating: views, jobs, constraints, dashboards, and data contracts.&lt;/LI&gt;&lt;LI&gt;Enabling column mapping upgrades the Delta protocol, typically to at least minReaderVersion = 2 and minWriterVersion = 5. It is effectively a one-way upgrade, so older Delta clients, external engines, or direct storage readers may no longer be compatible.&lt;/LI&gt;&lt;LI&gt;For &lt;STRONG&gt;changing the data type of an existing column&lt;/STRONG&gt;, the common pattern is to add a replacement column, backfill it, drop the original column, and rename the replacement.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Streaming-based&lt;/STRONG&gt; tables use persistent checkpoints. Schema changes must therefore be coordinated with the stream, do not casually delete or reset checkpoints. The stream may need to be stopped and restarted while preserving its checkpoint and progress.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;mergeSchema = true&lt;/STRONG&gt; supports additive schema evolution, but does not automatically make column renames safe.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2026 09:02:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-rename-a-column-in-a-delta-table/m-p/167257#M55661</guid>
      <dc:creator>data_pulse</dc:creator>
      <dc:date>2026-09-02T09:02:34Z</dc:date>
    </item>
  </channel>
</rss>

