<?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: Poor performance using Python to update Hosted Feature Layer in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1577755#M92184</link>
    <description>&lt;P&gt;Good to know, thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/374806"&gt;@PeterKnoop&lt;/a&gt;. I'm seeing more and more reasons to learn the API but haven't really used it yet.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2025 13:27:52 GMT</pubDate>
    <dc:creator>SteveJavins</dc:creator>
    <dc:date>2025-01-22T13:27:52Z</dc:date>
    <item>
      <title>Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576961#M92088</link>
      <description>&lt;P&gt;Hello, I am working on some Python code that updates a Hosted Feature Layer inside of ArcGIS Pro. However, performance is extremely slow. There are over 700k records in the feature class, but performance was acceptable when working with a FGDB. Accessing the hosted layer takes hours to run each step (e. g. and update cursor and select by location, see below)&lt;/P&gt;&lt;P&gt;Is this expected for a hosted feature layer? I'm using ArcGIS Pro 2.9.10 and Enterprise 10.9.1.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;with&lt;/SPAN&gt; &lt;SPAN&gt;arcpy&lt;/SPAN&gt;&lt;SPAN&gt;.da.UpdateCursor(&lt;/SPAN&gt;&lt;SPAN&gt;'featureClassName'&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN&gt;'fieldName'&lt;/SPAN&gt;&lt;SPAN&gt;]) &lt;/SPAN&gt;&lt;SPAN&g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/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;arcpy&lt;/SPAN&gt;&lt;SPAN&gt;.management.SelectLayerByLocation(&lt;/SPAN&gt;&lt;SPAN&gt;'featureClassName'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'INTERSECT'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'fieldName'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;None&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'NEW_SELECTION'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'INVERT'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If more details are needed please let me know. Any help would be appreciated.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 17 Jan 2025 21:51:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576961#M92088</guid>
      <dc:creator>SteveJavins</dc:creator>
      <dc:date>2025-01-17T21:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576969#M92090</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/106012"&gt;@SteveJavins&lt;/a&gt;&amp;nbsp;, I recommend first exporting the data from the hosted feature layer to a gdb, performing the updates there, then overwriting the hosted feature layer. If you don't want to overwrite the service, truncating it then appending to it from the feature class works well too.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 22:27:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576969#M92090</guid>
      <dc:creator>EzraBosworth-Ahmet</dc:creator>
      <dc:date>2025-01-17T22:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576973#M92092</link>
      <description>&lt;P&gt;Unfortunately hosted layers will almost always be slower than local file/mobile GDBs. If&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/96831"&gt;@EzraBosworth-Ahmet&lt;/a&gt;'s method doesn't work you can adjust your cursor to use a SQL filter:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.UpdateCursor('featureClassName', ['fieldName'], "fieldName = 'N'") as cursor:
    for row in cursor:
        cursor.updateRow([None])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or combine a Select By Attribute with a Calculate Field (you can even do the calculation in SQL to run it on the server in modern Enterprise versions). But yeah, in the general case you're losing performance with cursor updates once the server's involved.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 22:34:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576973#M92092</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-01-17T22:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576975#M92093</link>
      <description>&lt;P&gt;thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/96831"&gt;@EzraBosworth-Ahmet&lt;/a&gt;, appreciate the quick reply. I considered this but hoped to automate if possible. Can this be done with arcpy or would it require the Python for ArcGIS API? Any pointers to documentation?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 22:42:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576975#M92093</guid>
      <dc:creator>SteveJavins</dc:creator>
      <dc:date>2025-01-17T22:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576977#M92094</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/4413"&gt;@DavidSolari&lt;/a&gt;.&amp;nbsp;I considered this as well. Or having other references to the layer in the map with definition queries. Using SQL might be cleaner and any selects or attempts to field calculate in arcpy have been brutally slow.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 22:44:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576977#M92094</guid>
      <dc:creator>SteveJavins</dc:creator>
      <dc:date>2025-01-17T22:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576985#M92097</link>
      <description>&lt;P&gt;This can all be done with arcpy. I suggest doing the process manually with the Pro tools and copying the Python command. I find this speeds up dev time quite a bit!&lt;/P&gt;&lt;P&gt;The Pro tools would be Copy Features (input hosted feature layer, output feature class), whatever you were doing locally before to the feature class, Truncate (input is hosted feature layer), and Append (input layer is updated feature class, target layer is hosted feature layer)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EzraBosworthAhmet_0-1737155839990.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123565i2C4A1AECCB80BC91/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EzraBosworthAhmet_0-1737155839990.png" alt="EzraBosworthAhmet_0-1737155839990.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 23:18:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1576985#M92097</guid>
      <dc:creator>EzraBosworth-Ahmet</dc:creator>
      <dc:date>2025-01-17T23:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1577517#M92161</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/4413"&gt;@DavidSolari&lt;/a&gt;&amp;nbsp;, I wanted to let you know I tested using where clauses and they made a HUGE difference. However, there are two steps where they may not be doable. It was a great idea that I will be using either way. Thanks again.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 18:31:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1577517#M92161</guid>
      <dc:creator>SteveJavins</dc:creator>
      <dc:date>2025-01-21T18:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1577617#M92172</link>
      <description>&lt;P&gt;When working with Hosted Feature Layers, we've found that using the ArcGIS API for Python usually yields significantly better performance than ArcPy, especially if you apply your updates (or edits) in batches. What takes minutes with ArcPy might only take seconds with the ArcGIS API for Python.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 22:04:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1577617#M92172</guid>
      <dc:creator>PeterKnoop</dc:creator>
      <dc:date>2025-01-21T22:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1577755#M92184</link>
      <description>&lt;P&gt;Good to know, thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/374806"&gt;@PeterKnoop&lt;/a&gt;. I'm seeing more and more reasons to learn the API but haven't really used it yet.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 13:27:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1577755#M92184</guid>
      <dc:creator>SteveJavins</dc:creator>
      <dc:date>2025-01-22T13:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance using Python to update Hosted Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1579191#M92320</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/96831"&gt;@EzraBosworth-Ahmet&lt;/a&gt;&amp;nbsp;, I'm attempting the truncate/append method. However, the truncate tool fails on the hosted feature layer. Since my original post, I upgraded Pro to version 3.3 which I thought supported truncating hosted layers. But it still fails. I'm also seeing things about the 'supportsTruncate' setting but don't know how to update that. The sync option is not enabled on the layer. Any thoughts?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SteveJavins_0-1738003090015.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124104i34A3CB85031906E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SteveJavins_0-1738003090015.png" alt="SteveJavins_0-1738003090015.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 18:42:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/poor-performance-using-python-to-update-hosted/m-p/1579191#M92320</guid>
      <dc:creator>SteveJavins</dc:creator>
      <dc:date>2025-01-27T18:42:39Z</dc:date>
    </item>
  </channel>
</rss>

