<?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 Merge issue with column mask delta tables in Databricks Free Edition Help</title>
    <link>https://community.databricks.com/t5/databricks-free-edition-help/merge-issue-with-column-mask-delta-tables/m-p/124884#M378</link>
    <description>&lt;P&gt;Facing issue when doing merge of dataframe to delta table which has mask applied on two of the columns.&lt;/P&gt;&lt;P&gt;Code&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;DeltaTable.forName(sparkSession=spark,tableOrViewName=f'{catalog}.{schema}.{table_name}').alias('target').merge(
    new_df.alias('updates'),
    'updates.customerID = target.customerID'
).whenNotMatchedInsertAll().execute()&lt;/LI-CODE&gt;&lt;P&gt;Error&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[MISSING_ATTRIBUTES.RESOLVED_ATTRIBUTE_APPEAR_IN_OPERATION] Resolved attribute(s) "first_name" missing from "customerID", "first_name", "last_name", "city", "state" in operator !Project [customerID#153L, redact AS first_name#178, redact AS last_name#179, redact AS city#180, redact AS state#181]. Attribute(s) with the same name appear in the operation: "first_name".
Please check if the right attribute(s) are used. SQLSTATE: XX000
File &amp;lt;command-6480109877101749&amp;gt;, line 4
      1 DeltaTable.forName(sparkSession=spark,tableOrViewName=f'{catalog}.{schema}.{table_name}').alias('target').merge(
      2     new_df.alias('updates'),
      3     'updates.customerID = target.customerID'
----&amp;gt; 4 ).whenNotMatchedInsertAll().execute()
File /databricks/spark/python/pyspark/sql/connect/client/core.py:2377, in SparkConnectClient._handle_rpc_error(self, rpc_error)
   2363                 raise SparkConnectGrpcException(
   2364                     "Python versions in the Spark Connect client and server are different. "
   2365                     "To execute user-defined functions, client and server should have the "
   (...)
   2373                         "sqlState", default=SparkConnectGrpcException.CLIENT_UNEXPECTED_MISSING_SQL_STATE),
   2374                 ) from None
   2375             # END-EDGE
-&amp;gt; 2377             raise convert_exception(
   2378                 info,
   2379                 status.message,
   2380                 self._fetch_enriched_error(info),
   2381                 self._display_server_stack_trace(),
   2382             ) from None
   2384     raise SparkConnectGrpcException(
   2385         message=status.message,
   2386         sql_state=SparkConnectGrpcException.CLIENT_UNEXPECTED_MISSING_SQL_STATE,  # EDGE
   2387     ) from None
   2388 else:&lt;/LI-CODE&gt;&lt;P&gt;Merge works fine with spark.sql or with %sql but have issue with python syntax.&lt;/P&gt;&lt;P&gt;If the column mask is removed from the table, it works fine.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Jul 2025 08:45:52 GMT</pubDate>
    <dc:creator>arshadnehal</dc:creator>
    <dc:date>2025-07-11T08:45:52Z</dc:date>
    <item>
      <title>Merge issue with column mask delta tables</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/merge-issue-with-column-mask-delta-tables/m-p/124884#M378</link>
      <description>&lt;P&gt;Facing issue when doing merge of dataframe to delta table which has mask applied on two of the columns.&lt;/P&gt;&lt;P&gt;Code&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;DeltaTable.forName(sparkSession=spark,tableOrViewName=f'{catalog}.{schema}.{table_name}').alias('target').merge(
    new_df.alias('updates'),
    'updates.customerID = target.customerID'
).whenNotMatchedInsertAll().execute()&lt;/LI-CODE&gt;&lt;P&gt;Error&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[MISSING_ATTRIBUTES.RESOLVED_ATTRIBUTE_APPEAR_IN_OPERATION] Resolved attribute(s) "first_name" missing from "customerID", "first_name", "last_name", "city", "state" in operator !Project [customerID#153L, redact AS first_name#178, redact AS last_name#179, redact AS city#180, redact AS state#181]. Attribute(s) with the same name appear in the operation: "first_name".
Please check if the right attribute(s) are used. SQLSTATE: XX000
File &amp;lt;command-6480109877101749&amp;gt;, line 4
      1 DeltaTable.forName(sparkSession=spark,tableOrViewName=f'{catalog}.{schema}.{table_name}').alias('target').merge(
      2     new_df.alias('updates'),
      3     'updates.customerID = target.customerID'
----&amp;gt; 4 ).whenNotMatchedInsertAll().execute()
File /databricks/spark/python/pyspark/sql/connect/client/core.py:2377, in SparkConnectClient._handle_rpc_error(self, rpc_error)
   2363                 raise SparkConnectGrpcException(
   2364                     "Python versions in the Spark Connect client and server are different. "
   2365                     "To execute user-defined functions, client and server should have the "
   (...)
   2373                         "sqlState", default=SparkConnectGrpcException.CLIENT_UNEXPECTED_MISSING_SQL_STATE),
   2374                 ) from None
   2375             # END-EDGE
-&amp;gt; 2377             raise convert_exception(
   2378                 info,
   2379                 status.message,
   2380                 self._fetch_enriched_error(info),
   2381                 self._display_server_stack_trace(),
   2382             ) from None
   2384     raise SparkConnectGrpcException(
   2385         message=status.message,
   2386         sql_state=SparkConnectGrpcException.CLIENT_UNEXPECTED_MISSING_SQL_STATE,  # EDGE
   2387     ) from None
   2388 else:&lt;/LI-CODE&gt;&lt;P&gt;Merge works fine with spark.sql or with %sql but have issue with python syntax.&lt;/P&gt;&lt;P&gt;If the column mask is removed from the table, it works fine.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 08:45:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/merge-issue-with-column-mask-delta-tables/m-p/124884#M378</guid>
      <dc:creator>arshadnehal</dc:creator>
      <dc:date>2025-07-11T08:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Merge issue with column mask delta tables</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/merge-issue-with-column-mask-delta-tables/m-p/124920#M382</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/131451"&gt;@arshadnehal&lt;/a&gt;&amp;nbsp;are you saying that you're not satisfied with the SQL solution and you're seeking the python equivalent?&lt;BR /&gt;&lt;BR /&gt;Seems like an interesting problem!&lt;BR /&gt;&lt;BR /&gt;All the best,&lt;BR /&gt;BS&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 14:32:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/merge-issue-with-column-mask-delta-tables/m-p/124920#M382</guid>
      <dc:creator>BS_THE_ANALYST</dc:creator>
      <dc:date>2025-07-11T14:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Merge issue with column mask delta tables</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/merge-issue-with-column-mask-delta-tables/m-p/124927#M383</link>
      <description>&lt;P&gt;It looks like&amp;nbsp;Delta Lake APIs (i.e. DeltaTable... ) are not supported with&amp;nbsp;Row filters and column masks.&lt;BR /&gt;&lt;BR /&gt;Please see limitations:&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/tables/row-and-column-filters#limitations" target="_blank"&gt;https://docs.databricks.com/aws/en/tables/row-and-column-filters#limitations&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 14:53:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/merge-issue-with-column-mask-delta-tables/m-p/124927#M383</guid>
      <dc:creator>Pat</dc:creator>
      <dc:date>2025-07-11T14:53:02Z</dc:date>
    </item>
  </channel>
</rss>

