<?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 Delete features and error 504 and timed out in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1096659#M6615</link>
    <description>&lt;P&gt;I'm attempting to apply delete feature to a very large dataset in AGOL &amp;amp; it's timing out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dataset is a polygon feature class.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't use truncate because the feature class is sync enabled.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Couple of questions:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; What is the maximum number of records the ArcGIS API can handle for delete and append functions — &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/considerations-and-limitations.htm" target="_self"&gt;10,000 records?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Any python tips and tricks&amp;nbsp; to make this happen?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to python, so please provide scripts with comments &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import arcgis
from arcgis.gis import GIS
from arcgis.features import FeatureLayer

gis = GIS("https://xx.arcgis.com", username="xx", password="xx")

feature_layer_item = gis.content.search('7a4b389c86f74ab8bd8da440e1a87db4', item_type = 'Feature Service')[0]
flayers = feature_layer_item.layers
flayer = flayers[0]
flayer.delete_features(where="OBJECTID &amp;gt;= 0")&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Sep 2021 09:43:52 GMT</pubDate>
    <dc:creator>NickShannon2</dc:creator>
    <dc:date>2021-09-09T09:43:52Z</dc:date>
    <item>
      <title>Delete features and error 504 and timed out</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1096659#M6615</link>
      <description>&lt;P&gt;I'm attempting to apply delete feature to a very large dataset in AGOL &amp;amp; it's timing out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dataset is a polygon feature class.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't use truncate because the feature class is sync enabled.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Couple of questions:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; What is the maximum number of records the ArcGIS API can handle for delete and append functions — &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/considerations-and-limitations.htm" target="_self"&gt;10,000 records?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Any python tips and tricks&amp;nbsp; to make this happen?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to python, so please provide scripts with comments &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import arcgis
from arcgis.gis import GIS
from arcgis.features import FeatureLayer

gis = GIS("https://xx.arcgis.com", username="xx", password="xx")

feature_layer_item = gis.content.search('7a4b389c86f74ab8bd8da440e1a87db4', item_type = 'Feature Service')[0]
flayers = feature_layer_item.layers
flayer = flayers[0]
flayer.delete_features(where="OBJECTID &amp;gt;= 0")&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 09:43:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1096659#M6615</guid>
      <dc:creator>NickShannon2</dc:creator>
      <dc:date>2021-09-09T09:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Delete features and error 504 &amp;quot;timed out&amp;quot;</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1096669#M6616</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/error-http-error-504-gateway-time-out/td-p/857036" target="_blank"&gt;Solved: ERROR - HTTP Error 504: Gateway Time-out - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;from the "Related" posts beside your post&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 09:11:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1096669#M6616</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-09-09T09:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: Delete features and error 504 &amp;quot;timed out&amp;quot;</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1096677#M6617</link>
      <description>&lt;P&gt;&lt;SPAN class="n"&gt;Right, so&lt;/SPAN&gt; &lt;SPAN class="n"&gt;I&lt;/SPAN&gt;&lt;SPAN class="n"&gt; need to add:&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="n"&gt;asynchronous&lt;/SPAN&gt;&lt;SPAN class="o"&gt;=&lt;/SPAN&gt;&lt;SPAN class="default_value"&gt;False&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="default_value"&gt;I'm a newbie — where in the script do I add this? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 09:45:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1096677#M6617</guid>
      <dc:creator>NickShannon2</dc:creator>
      <dc:date>2021-09-09T09:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Delete features and error 504 and timed out</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1096680#M6618</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/313745"&gt;@NickShannon2&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I have added a script to delete data, I usually break it up into packs of 2000, queries are very dependent on network performance. Just unzip the scripts into a python project an install ArcGIS for python pip install arcgis the script you want to fill in is trunk_data.py&lt;/P&gt;&lt;P&gt;then on line 42 fill in your server details&amp;nbsp; and point to the service&amp;nbsp;&lt;/P&gt;&lt;P&gt;in agol you can get the service url details if you navigate to overview then url, you add /0 if there is only one service /1, /2 for the next etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HenryLindemann_2-1631180896214.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22653i588F54490F730F61/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HenryLindemann_2-1631180896214.png" alt="HenryLindemann_2-1631180896214.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HenryLindemann_0-1631180685998.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22651iABB32C2DBFBB354C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HenryLindemann_0-1631180685998.png" alt="HenryLindemann_0-1631180685998.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HenryLindemann_1-1631180795073.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22652i87E7AAF64BA99530/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HenryLindemann_1-1631180795073.png" alt="HenryLindemann_1-1631180795073.png" /&gt;&lt;/span&gt;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 09:52:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1096680#M6618</guid>
      <dc:creator>HenryLindemann</dc:creator>
      <dc:date>2021-09-09T09:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Delete features and error 504 and timed out</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1104676#M6715</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/400739"&gt;@HenryLindemann&lt;/a&gt;&amp;nbsp;— this script is a big improvement over my original script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, while the script doesn't time-out with a warning message — it does not delete all records.&amp;nbsp; For example, my dataset has 600k rows, the tunk_data script deletes 450k rows leaving 150k.&amp;nbsp; I have to click 'run' a few times to successfully delete all records.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas how to fix this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running the script using Juptyer Notebooks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 08:48:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-features-and-error-504-and-timed-out/m-p/1104676#M6715</guid>
      <dc:creator>NickShannon2</dc:creator>
      <dc:date>2021-10-05T08:48:04Z</dc:date>
    </item>
  </channel>
</rss>

