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: 

Cannot Remove Table from Delta Share

nick-monda
New Contributor III

Hello! 

We have some production data pipelines using delta shares that have previously worked but broken today and I can't find a new solution. 

 

I create a delta share: 

CREATE SHARE IF NOT EXISTS `local_new_2022`
 
Then, like normal, I add a table to the share with an alias: 
ADD TABLE `amplifydata_local_local`.`default`.`a3cfbc5bd7bc947eaa8526d48c77e1d39` AS `default`.`new_2022`;

I can confirm via the UI and queries that there is data in the table, and I can run `SHOW ALL IN SHARE` to confirm that this table has been added to the share. 
 
Now, however, I cannot remove the table from the share. I have tried using the alias name, as well as the full table reference, but neither of them works.  
ALTER SHARE local_new_2022 REMOVE TABLE default.new_2022;
ALTER SHARE local_new_2022 REMOVE TABLE amplifydata_local_local.default.new_2022;
ALTER SHARE local_new_2022 REMOVE TABLE amplifydata_local_local.default.a3cfbc5bd7bc947eaa8526d48c77e1d39

I can further confirm the share is part of the table, because when I try to drop the table, I am shown the error: 
2025-07-28 16:16:32 | INFO | loggers | *** databricks.sql.exc.ServerOperationError: [RequestId=cecff0fa-dad6-4804-b857-03227451e5e8 ErrorClass=INVALID_STATE] TABLE amplifydata_local_local.default.a3cfbc5bd7bc947eaa8526d48c77e1d39 cannot be deleted because it is being shared via Delta Sharing. It is shared through the following shares: local_new_2022. If you just want to update a shared view, please use ALTER VIEW instead.
 
 
I have also tried running REFRESH TABLE against the table itself. This seems to have had no effect. 
 
 
I would really appreciate any help trying to figure out how to remove this table from the share. 
7 REPLIES 7

Advika
Databricks Employee
Databricks Employee

Hello @nick-monda!

You're right, if a table is being shared through Delta Sharing, you'll get that error when attempting to drop it directly. Could you share the error message you’re seeing when running the ALTER SHARE ... REMOVE TABLE command?
Also, try running SHOW ALL IN SHARE ... command and note exactly how the table is listed, whether by alias or original name, and use that exact format in your command.

nick-monda
New Contributor III

Hello, sorry about that. Here is the error when trying to remove: 

ServerOperationError("[RequestId=f9953228-bb3a-4740-89dc-253a11e1d8b4 ErrorClass=TABLE_DOES_NOT_EXIST.RESOURCE_DOES_NOT_EXIST] Table 'local_new_2022.default.new_2022' does not exist.")

nick-monda
New Contributor III

Wanted to note, 

 

I see that the path is shows on the "not found" table is local_new_2022.default.new_2022, which looks like it is including local_new_2022 as a database? 

When I try something the full table path:  

ALTER SHARE local_new_2022 REMOVE TABLE amplifydata_local_local.default.a3cfbc5bd7bc947eaa8526d48c77e1d39

I get this: 
ServerOperationError: [RequestId=d25f1c81-092b-449e-bb4e-375921e39c28 ErrorClass=RESOURCE_DOES_NOT_EXIST.RESOURCE_DOES_NOT_EXIST] Shared Table 'default.a3cfbc5bd7bc947eaa8526d48c77e1d39' does not exist.

Interestingly, it is not including this first reference, aka there is no database, it is only default and the table name. 

 

 

ivan_calvo
Databricks Employee
Databricks Employee

Hello Nick,

According to the Delta Sharing Examples page, you cannot use the three namespace convention. It should be:

  • ALTER SHARE some_share REMOVE TABLE shared_schema.shared_tab;
  • ALTER SHARE some_share REMOVE SCHEMA some_schema;
  • ALTER SHARE some_share REMOVE VIEW shared_schema.shared_view;

Aren't you mixing Unity Catalog assets and Delta Share assets when dropping? I think that is why you're getting "RESOURCE_DOES_NOT_EXIST" on your last example.

I was showing examples of all the queries I have tried. 

 

I add the table: 
ALTER SHARE local_new_2022 ADD TABLE `amplifydata_local_local`.`default`.`a3cfbc5bd7bc947eaa8526d48c77e1d39` AS `default`.`new_2022`;

then I try to remove the table with the alias: 
ALTER SHARE local_new_2022 REMOVE TABLE default.new_2022;


and it does not work. However, this query has worked for months up to this week. 


ivan_calvo
Databricks Employee
Databricks Employee

Where are you running these queries?

Warehouses or clusters? If clusters, what DBR version?

Did you recently changed the compute type by any chance?

nick-monda
New Contributor III

We are using the databricks_sql python sdk: 

```python

from databricks import sql as databricks_sql
connection = databricks_sql.connect(
    server_hostname=server_hostname,
    http_path=http_path,
    access_token=access_token
)

with connection.cursor() as cursor:
    cursor.execute(query)
    rows = cursor.fetchall()
```



 
 
Pretty sure we are using warehouses. 
 

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now