<?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: Using ArcPy to Overwrite Hosted Feature Service Fails in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-arcpy-to-overwrite-hosted-feature-service/m-p/1125559#M11815</link>
    <description>&lt;P&gt;Are you attempting to update a single layer within a hosted service, or all the data for the entire service?&amp;nbsp; Have you verified that the following requirements have been met for the existing Feature Service + incoming data?&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;&lt;P&gt;Only hosted feature layer collection services can be overwritten&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The original data used to publish this layer should be available on the portal&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;3. The data file used to overwrite should be of the same format and filename as the original that was used to publish the layer&amp;nbsp; - If you originally uploaded a .zip file, your script will have to zip up the file(s) and overwrite with the new zip file.&lt;/P&gt;&lt;P&gt;4. The schema (column names, column data types) of the data_file should be the same as original. You can have additional or fewer rows (features).&lt;/P&gt;&lt;P&gt;Here is more information on that method:&lt;/P&gt;&lt;P&gt;&lt;A title="FeatureLayerCollectionManager.overwrite" href="https://developers.arcgis.com/python/api-reference/arcgis.features.managers.html#arcgis.features.managers.FeatureLayerCollectionManager.overwrite" target="_blank" rel="noopener"&gt;FeatureLayerCollectionManager.overwrite&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Dec 2021 20:08:48 GMT</pubDate>
    <dc:creator>TonyContreras_Frisco_TX</dc:creator>
    <dc:date>2021-12-13T20:08:48Z</dc:date>
    <item>
      <title>Using ArcPy to Overwrite Hosted Feature Service Fails</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-arcpy-to-overwrite-hosted-feature-service/m-p/1124958#M11810</link>
      <description>&lt;P&gt;I developed an arcpy script that includes overwriting a hosted feature service in Portal with data from a csv file.&amp;nbsp; The script ran just fine in ArcGIS Enterprise version 10.8.1 but I recently upgraded to 10.9.1 and it fails.&amp;nbsp; The script was written using Python 3.7.&amp;nbsp; Below is a copy of my script and attached is a log file.&amp;nbsp; Notice everything works fine up until manager.overwrite.&amp;nbsp; Did something change in 10.9.1 that is causing this to fail?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.features import *
import pandas as pd
import logging

#--------------PARAMETERS--------------
csv = r'\\MyServer\Events.csv' #CSV file that will be overwritten with updates from JSON
jsonEvents = 'https://TheJsonFile' #JSON file location on web
eventID = 'xxxx' #ID of feature layer in portal that will be overwritten.
portal = 'https://MyServer.azdes.gov/portal'
portalUID = 'UserName'
portalPWD = 'Password'


#------------Process----------------

#Create log file
logging.basicConfig(filename='logEvents.log', filemode='w', level=logging.INFO)

try:
    logging.info("Process Started")

    #Read JSON URL and copy to csv file
    df = pd.read_json(jsonEvents) #reads JSON file
    df.to_csv(csv,index=False,header=True)  #Writes json events to csv file
    logging.info('CSV Updated')

    #Log in to portal
    gis = GIS(url = portal, username = portalUID, password = portalPWD)
    logging.info('Logged in to Portal')

    #Identify the feature layer that will be overwritten and convert to feature layer collection
    fsEvents = gis.content.get(eventID)
    flcEvents = FeatureLayerCollection.fromitem(fsEvents)
    logging.info("Feature Layer Collection created")

    #Overwrite the feature layer collection with results from the csv
    flcEvents.manager.overwrite(csv)
    logging.info("Overwrite Successful.  End Process")

except:
    logging.exception('Process failed')
    raise&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 18:08:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-arcpy-to-overwrite-hosted-feature-service/m-p/1124958#M11810</guid>
      <dc:creator>LucasMurray2</dc:creator>
      <dc:date>2021-12-10T18:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using ArcPy to Overwrite Hosted Feature Service Fails</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-arcpy-to-overwrite-hosted-feature-service/m-p/1125559#M11815</link>
      <description>&lt;P&gt;Are you attempting to update a single layer within a hosted service, or all the data for the entire service?&amp;nbsp; Have you verified that the following requirements have been met for the existing Feature Service + incoming data?&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;&lt;P&gt;Only hosted feature layer collection services can be overwritten&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The original data used to publish this layer should be available on the portal&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;3. The data file used to overwrite should be of the same format and filename as the original that was used to publish the layer&amp;nbsp; - If you originally uploaded a .zip file, your script will have to zip up the file(s) and overwrite with the new zip file.&lt;/P&gt;&lt;P&gt;4. The schema (column names, column data types) of the data_file should be the same as original. You can have additional or fewer rows (features).&lt;/P&gt;&lt;P&gt;Here is more information on that method:&lt;/P&gt;&lt;P&gt;&lt;A title="FeatureLayerCollectionManager.overwrite" href="https://developers.arcgis.com/python/api-reference/arcgis.features.managers.html#arcgis.features.managers.FeatureLayerCollectionManager.overwrite" target="_blank" rel="noopener"&gt;FeatureLayerCollectionManager.overwrite&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 20:08:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-arcpy-to-overwrite-hosted-feature-service/m-p/1125559#M11815</guid>
      <dc:creator>TonyContreras_Frisco_TX</dc:creator>
      <dc:date>2021-12-13T20:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using ArcPy to Overwrite Hosted Feature Service Fails</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-arcpy-to-overwrite-hosted-feature-service/m-p/1125869#M11820</link>
      <description>&lt;P&gt;Thanks for your reply.&amp;nbsp; Yes, the file meets all of those criteria.&amp;nbsp; Plus, the python code above was working with ArcGIS Enterprise 10.8.1 but not with 10.9.1.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 15:12:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/using-arcpy-to-overwrite-hosted-feature-service/m-p/1125869#M11820</guid>
      <dc:creator>LucasMurray2</dc:creator>
      <dc:date>2021-12-14T15:12:14Z</dc:date>
    </item>
  </channel>
</rss>

