Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
truls_sg
Frequent Visitor

Creating files via lakehouse shortcut

Hi

I have two lakehouses, call them lh1 and lh2, and there is a shortcut from lh1 to lh2

 

When trying to create a file via the shortcut, I get an error if the file does not already exist on the path. If the file already exists on the path, then the write operation works fine.

 

Example:

data = {"name": "John Doe", "age": 30, "city": "New York"}

with open("/lakehouse/default/Files/shortcut_folder/data.json", "w", encoding="utf-8") as file:
     json.dump(data, file, indent=4, ensure_ascii=False)
 
If the file exists on path, the code runs fine via the shortcut (running with lh2 as default for the notebook").
If the file does not exist on path, I get an error saying no such file or directory when running with lh2 as default
If the file does not exist on path, but I run with lh1 as default lakehouse, there is no problem
 
In summary; I can write to a file via a shortcut, only if that file exists on path prior to me writing to the file (has been created with lh1 as default lakehouse). Then to me it does not look like a access problem since I can write and append an already existing file. What is happening here?
1 ACCEPTED SOLUTION
v-venuppu
Community Support
Community Support

Hi @truls_sg ,

Thank you for reaching out to Microsoft Fabric Community.

The issue occurs because shortcuts in Fabric lakehouses are read-only, meaning you can't create new files or folders through them - only read or overwrite existing files. That's why your code works only if the file already exists.

Set lh1 (the source lakehouse of the shortcut) as your default lakehouse in the notebook when writing files. This allows you to create new files successfully:

data = {"name": "John Doe", "age": 30, "city": "New York"}

with open("/lakehouse/default/Files/shortcut_folder/data.json", "w", encoding="utf-8") as file:
json.dump(data, file, indent=4, ensure_ascii=False)

If you're using lh2 as default, writing to a shortcut will only work for existing files - creation is blocked by design.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

Thank you.

View solution in original post

2 REPLIES 2
v-venuppu
Community Support
Community Support

Hi @truls_sg ,

Thank you for reaching out to Microsoft Fabric Community.

The issue occurs because shortcuts in Fabric lakehouses are read-only, meaning you can't create new files or folders through them - only read or overwrite existing files. That's why your code works only if the file already exists.

Set lh1 (the source lakehouse of the shortcut) as your default lakehouse in the notebook when writing files. This allows you to create new files successfully:

data = {"name": "John Doe", "age": 30, "city": "New York"}

with open("/lakehouse/default/Files/shortcut_folder/data.json", "w", encoding="utf-8") as file:
json.dump(data, file, indent=4, ensure_ascii=False)

If you're using lh2 as default, writing to a shortcut will only work for existing files - creation is blocked by design.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

Thank you.

So that is where my confusion comes in, becuase in my experience read only access usually does not allow you to modify existing files. 

Thank you for the answer!

Helpful resources

Announcements
Fabric July 2025 Monthly Update Carousel

Fabric Monthly Update - July 2025

Check out the July 2025 Fabric update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.