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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
aAmirkHan
Helper III
Helper III

Getting error while creating external table by using Delta Table in Apache Spark

Hi,

While practising in Lab 3 for DP 600 - Use Delta Table in Apache Spark. I am getting an error while creating an external table.

 

I am using the copy ABFS path from the File, and below is the full code.

 

df.write.format("delta").saveAsTable("external_products", path="abfss://4d1f6b14-075a-47b0-ab85-205195008be7@onelake.dfs.fabric.microsoft.com/8826417a-348f-488d-867a-554768d2ee1b/Files/external_products")

 

But it is giving me an error while running this code.

Py4JJavaError Traceback (most recent call last) Cell In[14], line 1 ----> 1 df.write.format("delta").saveAsTable("external_products", path="abfss://4d1f6b14-075a-47b0-ab85-205195008be7@onelake.dfs.fabric.microsoft.com/8826417a-348f-488d-867a-554768d2ee1b/Files/external_products") File /opt/spark/python/lib/pyspark.zip/pyspark/sql/readwriter.py:1586, in DataFrameWriter.saveAsTable(self, name, format, mode, partitionBy, **options) 1584 if format is not None: 1585 self.format(format) -> 1586 self._jwrite.saveAsTable(name) File ~/cluster-env/trident_env/lib/python3.11/site-packages/py4j/java_gateway.py:1322, in JavaMember.__call__(self, *args) 1316 command = proto.CALL_COMMAND_NAME +\ 1317 self.command_header +\

 

Please advise what to do.

1 ACCEPTED SOLUTION
suparnababu8
Super User
Super User

Hi @aAmirkHan 

 

I replicated your scenario.  You need to cjange your code like below example. it's working for me

df.write \
  .format("delta") \
  .option("path","abfss://Pyspark_Practise_WS@onelake.dfs.fabric.microsoft.com/rawdata_LS.Lakehouse/Files/Python_Assignment_1/Ele_Store1") \
  .saveAsTable("elec_store")

If i run this it was written to table section as delat table.

suparnababu8_0-1761668904254.png

 

In yout case you can use this code below..with your abfss path

df.write \
  .format("delta") \
  .option("path", "abfss://4d1f6b14-075a-47b0-ab85-205195008be7@onelake.dfs.fabric.microsoft.com/8826417a-348f-488d-867a-554768d2ee1b/Files/external_products") \
  .saveAsTable("external_products")

 

it will works. Hope this helps you..

 

Thank you

 

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

 

View solution in original post

3 REPLIES 3
aAmirkHan
Helper III
Helper III

Thank you, yes it is working fine now.

suparnababu8
Super User
Super User

Hi @aAmirkHan 

 

I replicated your scenario.  You need to cjange your code like below example. it's working for me

df.write \
  .format("delta") \
  .option("path","abfss://Pyspark_Practise_WS@onelake.dfs.fabric.microsoft.com/rawdata_LS.Lakehouse/Files/Python_Assignment_1/Ele_Store1") \
  .saveAsTable("elec_store")

If i run this it was written to table section as delat table.

suparnababu8_0-1761668904254.png

 

In yout case you can use this code below..with your abfss path

df.write \
  .format("delta") \
  .option("path", "abfss://4d1f6b14-075a-47b0-ab85-205195008be7@onelake.dfs.fabric.microsoft.com/8826417a-348f-488d-867a-554768d2ee1b/Files/external_products") \
  .saveAsTable("external_products")

 

it will works. Hope this helps you..

 

Thank you

 

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

 

i use your code and it can create external table.
but when i use "DESCRIBE FORMATTED external_products;", type is "MANAGED" (not "EXTERNAL"), location is "abfss://.../Tables/dbo/external_products" (not "abfss://.../Files/external_products").

Is it new feature or issues?

Helpful resources

Announcements
April Fabric Update Carousel

Fabric Monthly Update - April 2026

Check out the April 2026 Fabric update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.