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: 

Will the database be deleted when the cluster terminates ?

Logan_Data_Inc_
New Contributor II

Hello,

I'm working in Databricks Community Edition. So I will terminate my cluster after my work because anyways it will be terminated after 2 hours. I'm creating a database to store all my transformed data. Will the database be deleted when I terminate the cluster ?

I have tried it and seems like it will delete the database because it doesn't recognize the database name I gave.

Error Message - AnalysisException: Database 'db_name' not found

But I can see my database path in DBFS: dbfs:/user/hive/warehouse/db_name.db.

When I create a new database and try to add data to tables, then there is an error saying that the table already exists and not empty.

Please help me with this problem.

1 ACCEPTED SOLUTION

Accepted Solutions

Hubert-Dudek
Esteemed Contributor III

Problem is that it is community edition so metastore with databases didn't survive.

please try:

CREATE DATABASE IF NOT EXISTS db_name LOCATION 'dbfs:/user/hive/warehouse/db_name.db'

View solution in original post

3 REPLIES 3

Hubert-Dudek
Esteemed Contributor III

Problem is that it is community edition so metastore with databases didn't survive.

please try:

CREATE DATABASE IF NOT EXISTS db_name LOCATION 'dbfs:/user/hive/warehouse/db_name.db'

Thanks for the answer Hubert 😊

Anonymous
Not applicable

@Hubert Dudek​ - Thanks for answering so quickly!!

@Sriram Devineedi​ - If Hubert's answer solved the issue for you, would you be happy to mark his answer as best? That helps others know where to look.

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