databricksdelta-lakeaws-databricksdelta-live-tables

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


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?


Solution

  • The Delta Live Tables doesn't store data themselves in the Hive Metastore - all data together with metadata is stored under the location specified in the "Storage location" parameter in the pipeline settings, and when data is processed the tables are registered in the Hive Metastore as external tables (you should see EXTERNAL as data type in Data explorer), pointing to a specific location.

    Because of this, you can change the "Target" parameter in the pipeline settings, and on the next run, DLT will re-register tables in the given schema - no data will be reprocessed, just tables will be created in the new "Target". The only one thing you need to take into account - it will not remove the tables in the old schema, so you may need to drop them explicitly - because they are unmanaged, deletion of tables won't delete the data.