<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: clusterBy does not work in dataframe API? in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/clusterBy-does-not-work-in-dataframe-API/m-p/4759787#M10813</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="24978" data-lia-user-login="smpa01" class="lia-mention lia-mention-user"&gt;smpa01&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;the .clusterBy() method on DataFrameWriter&amp;nbsp;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&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Prashanth Are&lt;/P&gt;
&lt;P&gt;MS Fabric community support&lt;/P&gt;</description>
    <pubDate>Fri, 11 Jul 2025 07:49:05 GMT</pubDate>
    <dc:creator>v-prasare</dc:creator>
    <dc:date>2025-07-11T07:49:05Z</dc:date>
    <item>
      <title>clusterBy does not work in dataframe API?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/clusterBy-does-not-work-in-dataframe-API/m-p/4759338#M10807</link>
      <description>&lt;P&gt;The following works in databricks but not in fabric. It works through DeltaTable API though. But why does it not work through dataframeAPI?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# write load at t - Create the table with clustering enabled from the start
(df.write.format("delta")
         .mode("overwrite")
         .clusterBy("id") # &amp;lt;--- 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'&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrameWriter.html?highlight=writer#pyspark.sql.DataFrameWriter" target="_self"&gt;DataFrameWriter&lt;/A&gt;&amp;nbsp;Doc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2025 20:07:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/clusterBy-does-not-work-in-dataframe-API/m-p/4759338#M10807</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2025-07-10T20:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: clusterBy does not work in dataframe API?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/clusterBy-does-not-work-in-dataframe-API/m-p/4759787#M10813</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="24978" data-lia-user-login="smpa01" class="lia-mention lia-mention-user"&gt;smpa01&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;the .clusterBy() method on DataFrameWriter&amp;nbsp;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&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Prashanth Are&lt;/P&gt;
&lt;P&gt;MS Fabric community support&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 07:49:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/clusterBy-does-not-work-in-dataframe-API/m-p/4759787#M10813</guid>
      <dc:creator>v-prasare</dc:creator>
      <dc:date>2025-07-11T07:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: clusterBy does not work in dataframe API?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/clusterBy-does-not-work-in-dataframe-API/m-p/4765332#M10961</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="845241" data-lia-user-login="v-prasare" class="lia-mention lia-mention-user"&gt;v-prasare&lt;/a&gt;&amp;nbsp; 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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;df.write\
    .format("delta")\
    .mode("append")\
    .clustrBy (cluster by fields)\
    .save(file_path)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 13:11:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/clusterBy-does-not-work-in-dataframe-API/m-p/4765332#M10961</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2025-07-16T13:11:15Z</dc:date>
    </item>
  </channel>
</rss>

