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:ย 

How do I drop a delta live table?

TamD
Contributor

I'm a newbie and I've just done the "Run your first Delta Live Tables pipeline" tutorial.

The tutorial downloads a publicly available csv baby names file and creates two new Delta Live tables from it.  Now I want to be a good dev and clean up the resources so they aren't cluttering up the environment.  However, I can't find docco for dropping delta live tables.  You can't just drop them separately, because you get an error:

[STREAMING_TABLE_OPERATION_NOT_ALLOWED.DROP_DELTA_LIVE_TABLE] The operation DROP is not allowed: The operation does not apply to Streaming Tables created from Delta Live Tables, instead remove the Streaming Table from the pipeline definition in Delta Live Tables.

I removed the definitions of the two tables from the pipeline definition (per the above error), but then I get the error:

[DLT ERROR CODE: NO_TABLES_IN_PIPELINE] You attempted to update an empty pipeline. This error usually means no tables were discovered in your specified source code. Please verify that your source code includes table definitions.

What is the correct way to remove unwanted Delta Live Tables?

7 REPLIES 7

filipniziol
Contributor III

Hi @TamD ,

1. Delete the DLT Pipeline
2. Delete the delta tables created by DLT Pipeline

Hi @filipniziol  thank you for replying.  Have you confirmed that your method works?  And if you have, could you please provide more detail for the "delete the delta tables" part?  As I describe above, attempting to drop the tables outside of the pipeline results in an error.

gchandra
Databricks Employee
Databricks Employee

As DLT is a declarative coding, the pipeline is tightly coupled with the DLT table. 

Deleting the pipeline or removing that particular table from the pipeline and rerunning it will remove the DLT table. 



~

Deleting the DLT pipeline should delete the underlying data files, too. But as DLT tables / materialized views don't show us their ID or storage location, it is not trivial to find them and to make sure they are actually removed from storage right away or there is an intentional latency (e.g. 7 days as for delta tables).

See similar thread here: https://community.databricks.com/t5/data-engineering/where-are-materialized-view-generated-by-delta-...

Hi, @filipniziol 

One help, I have a doubt, how can i delete a delta tables created by DLT Pipeline if i haven't more acess to pipeline, the workspace is unaccessible.

TamD
Contributor

Thank you @gchandra .  Deleting the pipeline does indeed remove the materialized view definitions from the Catalog.  How can I confirm that the underlying S3 storage has also been cleared?  Just removing the pointers in the Catalog is not enough, if it leaves orphaned resources in cloud storage.  

ImranA
New Contributor III

@gchandra for example a table called "cars", if I remove the table from DLT pipeline and drop the table from catalog. Now if I change the schema of the table, and create the table again using the same table name "cars" through the same pipeline, Why I am getting schema mismatched error?

Why it didn't remove the schema, is there any other files that we need to be aware of in the backend which doesnt get deleted automatically?

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group