cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Move managed DLT table from one schema to another schema in Databricks

a_t_h_i
New Contributor II

I have a DLT table in schema A which is being loaded by DLT pipeline.

I want to move the table from schema A to schema B, and repoint my existing DLT pipeline to table in schema B. also I need to avoid full reload in DLT pipeline on table in Schema B.

Anybody had similar situation?

4 REPLIES 4

Tharun-Kumar
Databricks Employee
Databricks Employee

@a_t_h_i 

This feature is being actively worked upon by our Engineers. The plan is to change the schema name in the DLT pipeline settings and DLT will move the managed DLT table to the other schema.

ThuanVanNguyen
New Contributor II

Any updates on this since we are having this requirement

ChrisLawford_n1
Contributor

Any progress on this ? 
Did you find a solution ?

ManojkMohan
Contributor III

Have you tried the below

  1. Pause or Stop the DLT Pipeline
  • Prevent new writes while moving the table.

2.Move the Table in Metastore 

DLT uses Delta tables under the hood, so you can move the table in the metastore without copying data:

ALTER TABLE schemaA.tableX
SET LOCATION 'abfss://container@storage/path/...tableX';
ALTER TABLE schemaA.tableX
RENAME TO schemaB.tableX;

SET LOCATION points to the existing Delta storage location for the new schema.

3. Update the DLT Pipeline

Edit the DLT pipeline code (or the pipeline notebook) to point to the new fully qualified table name @Dlt.table(
name="schemaB.tableX", # updated schema
comment="Moved from schemaA"
)
def tableX():
return dlt.read("schemaB.tableX")

4. Resume the DLT Pipeline

Start the pipeline

5. Verify

SELECT COUNT(*) FROM schemaB.tableX;

Let me know here if the above is effective