Delta Live Table - Cannot redefine dataset
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 06:28 AM
Hi,
I am new to Delta Live Table.
I am trying to create a delta live table from the databricks tutorial.
I have created a notebook and attached an interactive cluster -DBR 14.3-LTS.
I am running the below code.
When I ran it for the 1st time it ran successfully.
When I ran the cell for the 2nd time I am getting error - AnalysisException: Cannot redefine dataset 'sales_orders_raw'
Can you please help me understand why this is happening?
----------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 07:55 AM
The error message "AnalysisException: Cannot redefine dataset 'sales_orders_raw'" is indicating that you're trying to create a table that already exists. In Databricks, once a Delta Live Table (DLT) is defined, it cannot be redefined or overwritten. This is to ensure the consistency and reliability of your data pipelines.
If you want to modify the table definition, you will need to delete the existing table first. However, be aware that this will also delete all the data in the table. If you want to keep the data, you should create a new table with a different name.
Here's how you can delete a DLT:
@dlt.delete_table
def sales_orders_raw():
pass
After running this, you should be able to redefine your sales_orders_raw
table.
Remember to be careful when deleting tables, especially in a production environment, as this action cannot be undone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2024 11:59 PM
Thanks for the suggestion.
But while I am executing delete_table command I am getting error - module 'dlt' has no attribute 'delete_table'
My cluster config -
If you can suggest please.

