cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Governance
Join discussions on data governance practices, compliance, and security within the Databricks Community. Exchange strategies and insights to ensure data integrity and regulatory compliance.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Accessing permanent file system from Databricks App

anton-genesis
Visitor

I have a Python-based FastAPI application with a React frontend, which I would like to deploy to Databricks apps. I'm able to do it, but having trouble with file system access. 

In addition to database access, my application relies on some file operations as well as a SQLite database.  Both of these require a durable storage of some sort. 

I have tried to get Unity Catalog Mount to work with no luck after spending quite a bit of time trying things, I'm pretty confident that UC is simply not mounted to the application's runtime server.  Relevant link:
https://community.databricks.com/t5/data-governance/accessing-unity-catalog-volumes-from-a-databrick...

So my question is this, is there really no way to make UC available and mounted to Python back-end without using any kind of Databricks APIs, but rather direct file access?  And if the answer is no, what are my options?

My requirements is to be able to read and write files directly.  I'm aware of certain SQLite limitation with network file systems, and I can work around them, but I would still like to access the file system for my other operations.

Thanks!

Anton


4 REPLIES 4

szymon_dybczak
Esteemed Contributor III

Hi,

The recommended approach is to add Unity Catalog resource to your Databricks App. As per documentation: 

"Add Unity Catalog volumes as Databricks Apps resources so your app can read from and write to files and directories stored in Unity Catalog with governance and access control. Volumes provide persistent storage for unstructured data, such as configuration files, model artifacts, logs, or other file-based data that your app needs."

Here's a step by step tutorial of how to configure it:

Add a Unity Catalog volume resource to a Databricks app - Azure Databricks | Microsoft Learn

When you successfully deploy Volume resource to your databricks apps then the volume path will be expose through environment variable:

szymon_dybczak_0-1763408128757.png

And you can interact with Volumes using standard os python module like they showed in documentation:

Work with files in Unity Catalog volumes | Databricks on AWS

szymon_dybczak_1-1763408209816.png

 

anton-genesis
Visitor

Thanks for your response! Very detailed.  I've tried this I believe without much luck.  I've created a small app just to test file access which you can see here:
I've configured the app to have a UC Volume:

antongenesis_0-1763409078192.png

The app is running, but I am not able to access to volume directly, only if I go through Databricks SDK. This is what I see when I try to use python OS functions:

antongenesis_1-1763409162394.png


Using Databricks SDK from another endpoint on the same app, I'm able to do it though:

antongenesis_2-1763409205494.png



So the question now is why the mount is not available to the App?

Thanks!

Anton

 

szymon_dybczak
Esteemed Contributor III

Hi,

That's interesting. I'll try to recreate your scenario tomorrow and let you know about my findings. Maybe explanation from related thread that you've attached is right? But that would be kinda lame ๐Ÿ˜„ This should be one of the basic things that you can do with apps and it should be straightforward ๐Ÿ™‚

 

anton-genesis
Visitor