<?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: Overwriting Hosted Feature Layer on ArcGIS Enterprise in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1243837#M8220</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/50038"&gt;@DerekRichards&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I recommend using a truncate/append rather than an overwrite.&amp;nbsp; See the following &lt;A href="https://community.esri.com/t5/arcgis-online-documents/overwrite-arcgis-online-feature-service-using/ta-p/904457" target="_self"&gt;document&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Dec 2022 17:35:45 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2022-12-27T17:35:45Z</dc:date>
    <item>
      <title>Overwriting Hosted Feature Layer on ArcGIS Enterprise</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1243833#M8219</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to automate the updating of hosted feature layers on my organizations Enterprise portal using ArcGIS API for Python. Running through the steps outlined in the &lt;A href="https://developers.arcgis.com/python/samples/overwriting-feature-layers/" target="_self"&gt;documentation&lt;/A&gt; does produce a success message and the date modified for the feature layer does update, yet the number of records and geometry stay the same when they should be changing. It is as if an update did not occur. Any advice would be appreciated, below is a sample of the code I am using with paths omitted:&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis import features&lt;/P&gt;&lt;P&gt;from arcgis.features import FeatureLayerCollection&lt;/P&gt;&lt;P&gt;local_layer_for_overwriting = location of feature class I want to use to update the hosted feature layer (actual location omitted)&lt;BR /&gt;portal_layer_itemid = 'itemid for the hosted feature layer on the Enterprise portal (omitted)'&lt;BR /&gt;portal_layer_dataitem = gis.content.get(portal_layer_itemid)&lt;BR /&gt;flayercol = FeatureLayerCollection.fromitem(portal_layer_dataitem)&lt;BR /&gt;flayercol.manager.overwrite(local_layer_for_overwriting)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 17:33:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1243833#M8219</guid>
      <dc:creator>DerekRichards</dc:creator>
      <dc:date>2022-12-27T17:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting Hosted Feature Layer on ArcGIS Enterprise</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1243837#M8220</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/50038"&gt;@DerekRichards&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I recommend using a truncate/append rather than an overwrite.&amp;nbsp; See the following &lt;A href="https://community.esri.com/t5/arcgis-online-documents/overwrite-arcgis-online-feature-service-using/ta-p/904457" target="_self"&gt;document&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 17:35:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1243837#M8220</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2022-12-27T17:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting Hosted Feature Layer on ArcGIS Enterprise</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1243963#M8222</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;May I ask why truncate/append rather than overwrite? Is there something about overwrite that would cause overwriting not to work correctly?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2022 14:11:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1243963#M8222</guid>
      <dc:creator>DerekRichards</dc:creator>
      <dc:date>2022-12-28T14:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting Hosted Feature Layer on ArcGIS Enterprise</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1243970#M8223</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I overwrite hosted services in portal with a different approach.&lt;/P&gt;&lt;P&gt;I have a project in ArcGIS Pro and have automated python script through task scheduler on the same machine (created generic python function that can be called to update any hosted services in portal by passing required values) which will do the following&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Get ArcGIS Pro project path&lt;/LI&gt;&lt;LI&gt;Create a sddraft(service file) from that project&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Stage that service&lt;/LI&gt;&lt;LI&gt;Connect to Portal and search service to be overwritten&lt;/LI&gt;&lt;LI&gt;Publish new service file (with overwrite option true)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here is the function, hope that helps&lt;/P&gt;&lt;P&gt;import os&lt;BR /&gt;import sys&lt;BR /&gt;import logging&lt;BR /&gt;import arcpy&lt;BR /&gt;import pprint&lt;BR /&gt;from datetime import datetime&lt;BR /&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;def overwriteHostedFeatureService(portal_url, user_name, pwd, prj_path, prj_name, mp_name, sd_fs_name, logfile_name):&lt;BR /&gt;logging.basicConfig(filename=logfile_name, format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.DEBUG)&lt;BR /&gt;logging.info(' ')&lt;BR /&gt;logging.info('Service Name - ' + sd_fs_name)&lt;BR /&gt;logging.info(' ')&lt;/P&gt;&lt;P&gt;portal = portal_url&lt;BR /&gt;user = user_name&lt;BR /&gt;password = pwd&lt;BR /&gt;fullPrjPath = os.path.join(prj_path, prj_name)&lt;BR /&gt;sddraft = os.path.join(prj_path, sd_fs_name + ".sddraft")&lt;BR /&gt;sd = os.path.join(prj_path, sd_fs_name + ".sd")&lt;/P&gt;&lt;P&gt;# Create a new SDDraft file, and stage the draft to the SD file.&lt;BR /&gt;logging.info("Creating SD file - " + sd)&lt;BR /&gt;logging.info("Creating SDDraft file - " + sddraft)&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;prj = arcpy.mp.ArcGISProject(fullPrjPath)&lt;BR /&gt;maps = prj.listMaps()&lt;BR /&gt;for map in maps:&lt;BR /&gt;if map.name == mp_name:&lt;BR /&gt;mp = map&lt;BR /&gt;logging.info("Map Name - " + mp.name)&lt;/P&gt;&lt;P&gt;arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS')&lt;/P&gt;&lt;P&gt;arcpy.StageService_server(sddraft, sd)&lt;BR /&gt;logging.info("Staging SD files Done")&lt;/P&gt;&lt;P&gt;# Connect to the specified portal&lt;BR /&gt;gis = GIS(portal, user, password)&lt;/P&gt;&lt;P&gt;# Locate the SD file, update, and overwrite the service on the specified portal&lt;BR /&gt;sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Service Definition")[0]&lt;BR /&gt;#enable this loggin for debuging purpose only&lt;BR /&gt;#logging.info("Found SD: {}, ID: {} n Uploading and overwriting…".format(sdItem.title, sdItem.id))&lt;BR /&gt;sdItem.update(data=sd)&lt;BR /&gt;fs = sdItem.publish(overwrite=True)&lt;BR /&gt;logging.info("Overwriting existing feature service finish")&lt;/P&gt;&lt;P&gt;# Set the desired sharing options. The following code sets the service to be shared with Everyone and organization.&lt;BR /&gt;shrOrg = True&lt;BR /&gt;shrEveryone = ""&lt;BR /&gt;shrGroups = ""&lt;/P&gt;&lt;P&gt;if shrOrg or shrEveryone or shrGroups:&lt;BR /&gt;fs.share(org=shrOrg, everyone=shrEveryone, groups=shrGroups)&lt;/P&gt;&lt;P&gt;logging.info("Finished updating: {} – ID: {}".format(fs.title, fs.id))&lt;BR /&gt;logging.info("-------------------------------------------------------")&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2022 14:43:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1243970#M8223</guid>
      <dc:creator>KetanDoshi</dc:creator>
      <dc:date>2022-12-28T14:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting Hosted Feature Layer on ArcGIS Enterprise</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1244702#M8234</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/50038"&gt;@DerekRichards&lt;/a&gt;&amp;nbsp;I personally try to steer clear of overwriting.&amp;nbsp; If you set any configurations in the Visualization tab for the feature service, these will be overwritten when you overwrite the feature service.&amp;nbsp; Also, typically you have an ArcGIS Pro project that is used when overwriting a feature service, which contains some settings (i.e. symbology, pop-ups, labels).&amp;nbsp; A truncate/append will not require you to use the Pro project.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Dec 2022 21:58:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1244702#M8234</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2022-12-31T21:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting Hosted Feature Layer on ArcGIS Enterprise</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1244859#M8237</link>
      <description>&lt;P&gt;I think this method could work but it appears I would need an upgrade to the Enterprise as append is only available for Enterprise version of&amp;nbsp;&lt;SPAN&gt;10.8.1+, and I currently experience append erroring out when I try to use it. Maybe overwrite also needs a 10.8.1+ Enterprise version as well?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 13:55:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1244859#M8237</guid>
      <dc:creator>DerekRichards</dc:creator>
      <dc:date>2023-01-03T13:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting Hosted Feature Layer on ArcGIS Enterprise</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1515617#M10406</link>
      <description>&lt;P&gt;were you ever able to accomplish this? what methods did you use?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 16:54:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1515617#M10406</guid>
      <dc:creator>sophered</dc:creator>
      <dc:date>2024-08-06T16:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting Hosted Feature Layer on ArcGIS Enterprise</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1664659#M11776</link>
      <description>&lt;P&gt;Hi Ketan, I ended up using this piece of code to implement updating data to a feature service. It was working up until last week. I believe that ESRI removed the "overwrite" argument. If you still have any scripts that use this code, has it broken for you as well?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 17:18:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-hosted-feature-layer-on-arcgis/m-p/1664659#M11776</guid>
      <dc:creator>adongre1</dc:creator>
      <dc:date>2025-11-10T17:18:55Z</dc:date>
    </item>
  </channel>
</rss>

