Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
The following works in databricks but not in fabric. It works through DeltaTable API though. But why does it not work through dataframeAPI?
# write load at t - Create the table with clustering enabled from the start
(df.write.format("delta")
.mode("overwrite")
.clusterBy("id") # <--- ADD THIS LINE HERE to enable clustering at creation
.saveAsTable(table_name) # Use the fully qualified name here for consistency
)
# AttributeError: 'DataFrameWriter' object has no attribute 'clusterBy'
DataFrameWriter Doc
Solved! Go to Solution.
Hi @smpa01 ,
the .clusterBy() method on DataFrameWriter is not supported because Fabric uses a customized Spark runtime that limits certain APIs to ensure simplicity and compatibility within its managed environment. Unlike Databricks, which offers extended Delta Lake features directly through the PySpark DataFrameWriter, Fabric restricts clustering capabilities to SQL DDL and the DeltaTable API
Thanks,
Prashanth Are
MS Fabric community support
Hi @smpa01 ,
the .clusterBy() method on DataFrameWriter is not supported because Fabric uses a customized Spark runtime that limits certain APIs to ensure simplicity and compatibility within its managed environment. Unlike Databricks, which offers extended Delta Lake features directly through the PySpark DataFrameWriter, Fabric restricts clustering capabilities to SQL DDL and the DeltaTable API
Thanks,
Prashanth Are
MS Fabric community support
@v-prasare without clusterBy in dataframe writer, I am guessing the clusterd files can't be written, if one intends to write only the raw files with the intention to create an external table.
df.write\
.format("delta")\
.mode("append")\
.clustrBy (cluster by fields)\
.save(file_path)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the September 2025 Fabric update to learn about new features.
| User | Count |
|---|---|
| 14 | |
| 7 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 27 | |
| 10 | |
| 5 | |
| 4 | |
| 3 |