<?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: Error during merge operation: 'NoneType' object has no attribute 'collect' in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102541#M41154</link>
    <description>&lt;P&gt;Can you share the complete error message you are receiving? Also share more details around the cluster configuration you are currently using when running single user cluster?&lt;/P&gt;</description>
    <pubDate>Wed, 18 Dec 2024 17:58:34 GMT</pubDate>
    <dc:creator>Walter_C</dc:creator>
    <dc:date>2024-12-18T17:58:34Z</dc:date>
    <item>
      <title>Error during merge operation: 'NoneType' object has no attribute 'collect'</title>
      <link>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102539#M41153</link>
      <description>&lt;P&gt;Why does merge.collect() not return results in access mode: SINGLE_USER, but it does in USER_ISOLATION? I need to log the affected rows (inserted and updated) and can’t find a simple way to get this data in SINGLE_USER mode. Is there a solution or an alternative method to retrieve this information?&lt;BR /&gt;&lt;BR /&gt;#merge&lt;/P&gt;&lt;P&gt;#SINGLE_USER&lt;/P&gt;&lt;P&gt;#USER_ISOLATION&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 17:42:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102539#M41153</guid>
      <dc:creator>GS_S</dc:creator>
      <dc:date>2024-12-18T17:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Error during merge operation: 'NoneType' object has no attribute 'collect'</title>
      <link>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102541#M41154</link>
      <description>&lt;P&gt;Can you share the complete error message you are receiving? Also share more details around the cluster configuration you are currently using when running single user cluster?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 17:58:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102541#M41154</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-12-18T17:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error during merge operation: 'NoneType' object has no attribute 'collect'</title>
      <link>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102542#M41155</link>
      <description>&lt;P&gt;In &lt;CODE&gt;SINGLE_USER&lt;/CODE&gt; mode, there are limitations, including restrictions on accessing certain tables and views, especially those with fine-grained access controls like row filters or column masks. This mode is designed to ensure that only the user who owns the cluster can access the data, which can lead to issues when trying to collect results from operations like &lt;CODE&gt;merge&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 17:59:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102542#M41155</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-12-18T17:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error during merge operation: 'NoneType' object has no attribute 'collect'</title>
      <link>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102548#M41156</link>
      <description>&lt;P&gt;Given the limitations of SINGLE_USER mode, could you suggest any alternative approach or workaround to collect the affected rows (inserted and updated) in this mode? Is there a way to enable access or adjust settings to allow this in SINGLE_USER mode? Additionally, could you clarify the potential risks or drawbacks of using USER_ISOLATION mode for this purpose?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 18:36:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102548#M41156</guid>
      <dc:creator>GS_S</dc:creator>
      <dc:date>2024-12-18T18:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error during merge operation: 'NoneType' object has no attribute 'collect'</title>
      <link>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102550#M41157</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have a piece of code that performs a merge operation followed by merge_result.collect(). This code is executed in two different scenarios:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Through Databricks Jobs with &lt;STRONG&gt;USER_ISOLATION&lt;/STRONG&gt; access mode.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case, merge_result.collect() works correctly and returns the expected result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Example output: &lt;EM&gt;Row(num_affected_rows=219921, num_updated_rows=0, num_deleted_rows=0, num_inserted_rows=219921)&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Through Databricks Jobs with &lt;STRONG&gt;SINGLE_USER&lt;/STRONG&gt; access mode.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case, merge_result.collect() returns None, causing the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;U&gt;&lt;EM&gt;AttributeError: 'NoneType' object has no attribute 'collect'&lt;/EM&gt;&lt;/U&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The same code is deployed in both scenarios via GitHub Actions using Databricks Bundles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Environment Details&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Databricks Runtime: 14.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cluster Access Modes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SINGLE_USER (causes the issue)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;USER_ISOLATION (works correctly)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The merge operation code is as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;merge_result = (
target_df.alias("target")
.merge(source_df.alias("source"), merge_condition)
.whenMatchedUpdate(set=update_columns)
.whenNotMatchedInsert(values=insert_columns)
.execute()
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;row = merge_result.collect()[0]&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;How do the access modes (USER_ISOLATION vs. SINGLE_USER) impact the execution of merge operations?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What alternatives to merge_result.collect() exist for retrieving merge results that would work in SINGLE_USER mode?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there any recommended practices or patterns to ensure the merge operation and result retrieval work correctly in this mode?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 18:44:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102550#M41157</guid>
      <dc:creator>GS_S</dc:creator>
      <dc:date>2024-12-18T18:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Error during merge operation: 'NoneType' object has no attribute 'collect'</title>
      <link>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102554#M41158</link>
      <description>&lt;P&gt;Can you test DBR 15.4 LTS, seems that this DBR version and above supports&amp;nbsp;&lt;SPAN&gt;fine-grained access control on single user compute, which may resolve your issue&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 19:00:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102554#M41158</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-12-18T19:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error during merge operation: 'NoneType' object has no attribute 'collect'</title>
      <link>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102558#M41159</link>
      <description>&lt;P&gt;Doesn't DBR 15.4 LTS require serverless compute to be enabled on the workspace? If so, wouldn't this lead to an increase in costs for the project?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 19:05:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102558#M41159</guid>
      <dc:creator>GS_S</dc:creator>
      <dc:date>2024-12-18T19:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Error during merge operation: 'NoneType' object has no attribute 'collect'</title>
      <link>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102569#M41160</link>
      <description>&lt;P&gt;15.4 does not directly required the serverless but for fine-grained it indeed requires it to run it on Single User as mentioned&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This data filtering is performed behind the scenes using serverless compute.&lt;/P&gt;
&lt;DIV id="why-do-some-queries-on-single-user-compute-require-data-filtering" class="section"&gt;&lt;BR /&gt;In terms of costs:&lt;BR /&gt;&lt;SPAN&gt;Customers are charged for the serverless compute resources that are used to perform data filtering operations. For pricing information, see&amp;nbsp;&lt;/SPAN&gt;&lt;A class="reference external" href="https://www.databricks.com/product/pricing/platform-addons" target="_blank" rel="noopener"&gt;Platform Tiers and Add-Ons&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;If you dont want to enable Serverless on this case you will need to continue using shared access mode, which the main implication is that multiple users will be able to use this cluster if they have permissions to.&lt;/DIV&gt;</description>
      <pubDate>Wed, 18 Dec 2024 19:56:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-during-merge-operation-nonetype-object-has-no-attribute/m-p/102569#M41160</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-12-18T19:56:59Z</dc:date>
    </item>
  </channel>
</rss>

