cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Unable to delete schema with no tables

sapatel10
New Contributor II

I create Azure Databricks workspaces using Terraform. As a part of workspace creation I create the catalog and a schema in the catalog but not the tables. After this I follow below steps:

1. Create managed tables in the schema using Databricks workspace UI

2. Delete all managed tables in the schema using Databricks worksapce UI

3. Now deleting the schema using terraform or using Databricks UI is giving error that schema has managed table(s) and hence schema cannot be deleted. I need to know why?

 

2 REPLIES 2

ShamenParis
Contributor III

Hi @sapatel10 , 

There are a few potential factors to consider regarding this issue. If Terraform authenticates using a Service Principal (SPN), the SPN is assigned as the owner of the schema. Furthermore, any hidden tables within the schema will not be visible to you unless you hold MANAGE permissions.

To completely remove the schema and its contents, you can execute the following SQL command using the CASCADE clause

DROP SCHEMA <catalog>.<schema> CASCADE;

 

pradeep_singh
Honored Contributor III

As suggested by @ShamenParis 
1 - DROP SCHEMA catalog_name.schema_name CASCADE;
2 - 

resource "databricks_schema" "this" {
  catalog_name  = databricks_catalog.this.name
  name          = "example"
  force_destroy = true
}



Thank You
Pradeep Singh - https://www.linkedin.com/in/dbxdev