cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

What is a recommended directory for creating a database with a specified path?

Dilorom
New Contributor

I was going through Data Engineering with Databricks training, and in DE 3.3L - Databases, Tables & Views Lab section, it says "Defining database directories for groups of users can greatly reduce the chances of accidental data exfiltration." I agree with it, and want to specify a path for my database, but not sure what directory is ideal to provide as a path. Under DBFS, what directory would be the best to create my database? Any best practices or recommendations around this?

5 REPLIES 5

Kaniz
Community Manager
Community Manager

Hi @Dilorom A​, Under Databricks File System (DBFS), the best directory to create your database would be /dbfs/<your-directory>.

When you create a directory under /dbfs/, it is made in the underlying cloud storage, such as Amazon S3 or Azure Blob Storage, and is accessible from your Databricks workspace.

Any data you write to this directory is stored in the cloud and can be accessed from different clusters or notebooks in your Databricks workspace.

To create a database directory under /dbfs/, you can use the Databricks CLI or the Databricks notebook UI.

Here is an example of how to create a database directory using the Databricks CLI:

databricks fs mkdirs /dbfs/my-database

This will create a directory named my-database under /dbfs/. You can then use this directory to store your database files.

Note that if you use Databricks SQL to create a database, you can specify the location of the database files using the LOCATION clause in your CREATE DATABASE statement.

In this case, you can specify the directory you created under /dbfs/. For example:

CREATE DATABASE mydatabase LOCATION '/dbfs/my-database'

Rishabh264
Honored Contributor II

great explanation @Kaniz Fatma​ 

Kaniz
Community Manager
Community Manager

Thank you @Rishabh Pandey​ !

youssefmrini
Honored Contributor III
Honored Contributor III

With Unity Catalo, if it's managed location you can define the location of where to store the catalog or the Database or the table. ( Needs to be a Delta table ofc)

Anonymous
Not applicable

Hi @Dilorom A​ 

Hope everything is going great.

Just wanted to check in if you were able to resolve your issue. If yes, would you be happy to mark an answer as best so that other members can find the solution more quickly? If not, please tell us so we can help you. 

Cheers!

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.