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: 

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_Fatma
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'

great explanation @Kaniz Fatma​ 

Rishabh Pandey

Thank you @Rishabh Pandey​ !

youssefmrini
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!

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