- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2026 10:08 PM
I have a notebook which generates a bunch of excel and pdf reports. These reports needs to be sent out through email and also needs to be archived in external location.
i am able to generate these reports in the /tmp file and then send them as attachments. But to archive it , when i try to copy it to the external location it is throwing the error: insufficient access.
its a unity catalog enabled Databrics instance.
I have tried shutils and dbutils but shutils donot recognize the abfss path whereas dbutils donot recognize the /tmp path.
any suggestions would be very helpful
thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2026 03:57 AM
Hi @deepu,
The reason it isn't working is that Python’s shutil only understands local/POSIX-style paths, not abfss:// URIs, and dbutils.fs expects Databricks-style paths (e.g., file:/..., /Volumes/...).
The recommended pattern for this is..
- Write reports to local disk (what you already do, /tmp).
- Copy from local disk --> a Unity Catalog volume (backed by your external location).
- Always reference the volume via /Volumes/... paths inside Databricks, not raw abfss:// from Python stdlib.
On Unity Catalog enabled clusters, you’re dealing with two different file systems:
- /tmp is ephemeral local storage on the driver.
- abfss://... is remote cloud storage.
Firstly, back your external location with a UC volume if you haven't done that already. For example,
CREATE EXTERNAL VOLUME main.reporting.reports_archive
LOCATION 'abfss://<container>@<account>.dfs.core.windows.net/<path>';
Make sure the user/service has USE CATALOG, USE SCHEMA and WRITE VOLUME on this volume.
dbutils.fs.cp(
"file:/tmp/my_report.xlsx",
"/Volumes/main/reporting/reports_archive/my_report.xlsx",
True # overwrite
)
from shutil import copyfile
copyfile(
"/tmp/my_report.xlsx",
"/Volumes/main/reporting/reports_archive/my_report.xlsx"
)
- See "Ephemeral storage" and "Move data from ephemeral storage to volumes" - https://learn.microsoft.com/en-us/azure/databricks/files/
- See how /Volumes/... works, examples with POSIX paths and dbutils.fs - https://learn.microsoft.com/en-us/azure/databricks/volumes/volume-files
If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.
Ashwin | Delivery Solution Architect @ Databricks
Helping you build and scale the Data Intelligence Platform.
***Opinions are my own***