<?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 Change data feed for tables with allowColumnDefaults property &amp;quot;enabled&amp;quot; in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88584#M37554</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I have a Delta table already created, with both enabled the&amp;nbsp;#&lt;/SPAN&gt;&lt;SPAN&gt;enableChangeDataFeed option&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and #allowColumnDefaults properties. However when writing to CDC table with streaming queries it fails with the following error [CREATE TABLE command because it assigned a column DEFAULT value, but corresponding table feature was not enabled. Please retry command again after executing ALTER TABLE table_name SET TBLPROPERTIES(#'delta.feature.allowColumnDefaults' = 'supported')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My understanding is that this CREATE TABLE is inside the box of&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;#&lt;/SPAN&gt;enableChangeDataFeed feature, since adding metadata columns (&lt;A href="https://docs.delta.io/latest/delta-change-data-feed.html#what-is-the-schema-for-the-change-data-feed" target="_blank" rel="noopener"&gt;https://docs.delta.io/latest/delta-change-data-feed.html#what-is-the-schema-for-the-change-data-feed&lt;/A&gt;) , so I was wondering is there a way to set required for this case properties (#&lt;SPAN&gt;'delta.feature.allowColumnDefaults' = 'supported')&lt;/SPAN&gt;when reading and writing with Streaming queries.&lt;BR /&gt;I mean how to resolve missing property before streaming query starts if I am not creating or running CREATE TABLE statement for CDC table myself?&lt;/DIV&gt;</description>
    <pubDate>Wed, 04 Sep 2024 17:28:28 GMT</pubDate>
    <dc:creator>n_joy</dc:creator>
    <dc:date>2024-09-04T17:28:28Z</dc:date>
    <item>
      <title>Change data feed for tables with allowColumnDefaults property "enabled"</title>
      <link>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88584#M37554</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have a Delta table already created, with both enabled the&amp;nbsp;#&lt;/SPAN&gt;&lt;SPAN&gt;enableChangeDataFeed option&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and #allowColumnDefaults properties. However when writing to CDC table with streaming queries it fails with the following error [CREATE TABLE command because it assigned a column DEFAULT value, but corresponding table feature was not enabled. Please retry command again after executing ALTER TABLE table_name SET TBLPROPERTIES(#'delta.feature.allowColumnDefaults' = 'supported')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My understanding is that this CREATE TABLE is inside the box of&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;#&lt;/SPAN&gt;enableChangeDataFeed feature, since adding metadata columns (&lt;A href="https://docs.delta.io/latest/delta-change-data-feed.html#what-is-the-schema-for-the-change-data-feed" target="_blank" rel="noopener"&gt;https://docs.delta.io/latest/delta-change-data-feed.html#what-is-the-schema-for-the-change-data-feed&lt;/A&gt;) , so I was wondering is there a way to set required for this case properties (#&lt;SPAN&gt;'delta.feature.allowColumnDefaults' = 'supported')&lt;/SPAN&gt;when reading and writing with Streaming queries.&lt;BR /&gt;I mean how to resolve missing property before streaming query starts if I am not creating or running CREATE TABLE statement for CDC table myself?&lt;/DIV&gt;</description>
      <pubDate>Wed, 04 Sep 2024 17:28:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88584#M37554</guid>
      <dc:creator>n_joy</dc:creator>
      <dc:date>2024-09-04T17:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Change data feed for tables with allowColumnDefaults property "enabled"</title>
      <link>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88591#M37556</link>
      <description>&lt;P&gt;ERROR:[WRONG_COLUMN_DEFAULTS_FOR_DELTA_FEATURE_NOT_ENABLED] Failed to execute&amp;nbsp;&lt;SPAN&gt;CREATE TABLE command because it assigned a column DEFAULT value, but corresponding table feature was not enabled. Please retry command again after executing ALTER TABLE table_name SET TBLPROPERTIES(#'delta.feature.allowColumnDefaults' = 'supported')&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 18:26:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88591#M37556</guid>
      <dc:creator>n_joy</dc:creator>
      <dc:date>2024-09-04T18:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Change data feed for tables with allowColumnDefaults property "enabled"</title>
      <link>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88663#M37565</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/119270"&gt;@n_joy&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;what is your limitation here?&lt;BR /&gt;You cannot run the statement mentioned in the error message?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ALTER TABLE table_name 
SET TBLPROPERTIES('delta.feature.allowColumnDefaults' = 'supported')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I understand correctly that the table is created, you do not have permissions to run ALTER statement, so you want to somehow change this property with steaming query?&lt;BR /&gt;&lt;BR /&gt;If yes, it is not possible.&lt;/P&gt;&lt;P&gt;Streaming queries that insert data are DML (Data Manipulation Language) statements, which are used to modify the data within the table (e.g., INSERT, UPDATE).&lt;/P&gt;&lt;P&gt;ALTER statements are DDL (Data Definition Language) statements, which are used to modify the structure or properties of the table itself.&lt;/P&gt;&lt;P&gt;DML and DDL statements cannot be mixed in a streaming query. This is a fundamental limitation in SQL operations, meaning you cannot modify table properties while performing data insertions through streaming.&lt;BR /&gt;&lt;BR /&gt;Additionally, even creating a table with DEFAULT without&amp;nbsp;'delta.feature.allowColumnDefaults' property fails.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filipniziol_0-1725520518981.png" style="width: 651px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10937i1D68826CCB5F3BEA/image-dimensions/651x215?v=v2" width="651" height="215" role="button" title="filipniziol_0-1725520518981.png" alt="filipniziol_0-1725520518981.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To sum up, the only way to make it work is to run the ALTER command and set&amp;nbsp;'delta.feature.allowColumnDefaults' = 'supported'.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 07:21:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88663#M37565</guid>
      <dc:creator>filipniziol</dc:creator>
      <dc:date>2024-09-05T07:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Change data feed for tables with allowColumnDefaults property "enabled"</title>
      <link>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88677#M37570</link>
      <description>&lt;P&gt;Case is the following: "For some reason, the Change Data Feed feature recognizes DEFAULT columns from the source but does not enable this property when creating a _cdc table.":&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="n_joy_0-1725523337664.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10940i3B1BA2981B7E6CF0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="n_joy_0-1725523337664.png" alt="n_joy_0-1725523337664.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So it uses the following DDL that is impossible to execute:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="n_joy_2-1725523954329.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10942iCFDEB12AE23C5B9C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="n_joy_2-1725523954329.png" alt="n_joy_2-1725523954329.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Instead of this one:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="n_joy_4-1725524553528.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10944iD1F6225733DCEF5B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="n_joy_4-1725524553528.png" alt="n_joy_4-1725524553528.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As a workaround , prior to run streaming queries I create a cdc table myself&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="n_joy_3-1725524454093.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10943iF7B2F7AB04E5BDE8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="n_joy_3-1725524454093.png" alt="n_joy_3-1725524454093.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I was just wondering whether there is any other way without explicitly running DDL for _cdc table myself.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 08:23:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88677#M37570</guid>
      <dc:creator>n_joy</dc:creator>
      <dc:date>2024-09-05T08:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Change data feed for tables with allowColumnDefaults property "enabled"</title>
      <link>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88679#M37572</link>
      <description>&lt;P&gt;&lt;A class="" href="https://community.databricks.com/t5/user/viewprofilepage/user-id/117376" target="_self"&gt;&lt;SPAN class=""&gt;@filipniziol&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;Hi! Thank you for your response! Please see my comments above.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 08:32:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88679#M37572</guid>
      <dc:creator>n_joy</dc:creator>
      <dc:date>2024-09-05T08:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change data feed for tables with allowColumnDefaults property "enabled"</title>
      <link>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88699#M37586</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/119270"&gt;@n_joy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Based on the docs it will not be possible.&lt;/P&gt;&lt;P&gt;&lt;A href="https://spark.apache.org/docs/latest/api/python/reference/pyspark.ss/api/pyspark.sql.streaming.DataStreamWriter.htm" target="_blank"&gt;https://spark.apache.org/docs/latest/api/python/reference/pyspark.ss/api/pyspark.sql.streaming.DataStreamWriter.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you check toTable definition, it suggest the table is already in place ("&lt;SPAN&gt;output results to the given table").&lt;BR /&gt;I think the fact that the table is is being created is anyway pretty cool.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Neither delta lake documentation you shared nor the Apache Spark documentation offer any parameter that enable configuring table properties.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The solution here is to have CREATE script for a table, specify the table properties and then to run streaming query to insert the data.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 10:38:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88699#M37586</guid>
      <dc:creator>filipniziol</dc:creator>
      <dc:date>2024-09-05T10:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change data feed for tables with allowColumnDefaults property "enabled"</title>
      <link>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88705#M37591</link>
      <description>&lt;P&gt;@&lt;A class="" href="https://community.databricks.com/t5/user/viewprofilepage/user-id/117376" target="_self"&gt;&lt;SPAN class=""&gt;filipniziol&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;Yes, that is what I do &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;Thanks for feedback !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 11:14:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/change-data-feed-for-tables-with-allowcolumndefaults-property/m-p/88705#M37591</guid>
      <dc:creator>n_joy</dc:creator>
      <dc:date>2024-09-05T11:14:03Z</dc:date>
    </item>
  </channel>
</rss>

