02-19-2023 02:51 PM
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?
02-22-2023 01:45 AM
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'
02-22-2023 02:08 AM
great explanation @Kaniz Fatma
02-22-2023 02:09 AM
Thank you @Rishabh Pandey !
02-24-2023 05:42 AM
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)
04-21-2023 09:47 PM
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!
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