Hello,
I am trying to systematically overwrite a large point Feature Layer on ArcGIS online using the ArcGIS API for Python. I am closely following the example here:overwriting_feature_layers | ArcGIS for Developers and referring to this: FeatureLayerCollectionManager - Overwrite to guide me through the process. However, I keep getting the following error message:
Traceback (most recent call last):
File "C:\GIS\AVGOPS\Scripts\extractVehicles_1Week_AGOL.py", line 51, in <module>
speeds.manager.overwrite(outputFile)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\managers.py", line 748, in overwrite
published_item = related_data_item.publish(publish_parameters, overwrite=True)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 4278, in publish
serviceitem_id = self._check_publish_status(ret, folder)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 4390, in _check_publish_status
raise Exception("Job failed.")
Exception: Job failed.
I am not sure what is happening here. I made sure that the schema, filename and file type are the same as the original upload. The file is large ( about 70000 point features). Could it be timing out?
Any advice would help.
Thanks,
Pat
Solved! Go to Solution.
I am also having this issue. Overwrite works when editing is turned off in the hosted feature layer settings. When editing is turned on, the job fails. I can manually overwrite the feature layer in AGOL by going to the item's overview page and clicking "Update Data" ==> "Overwrite Entire Layer" but running the overwrite through the ArcGIS Python API doesn't seem to work when editing is turned on. As soon as I uncheck editing in the feature layer settings, the code works again. Not sure what is happening here.
I am also having this issue. Overwrite works when editing is turned off in the hosted feature layer settings. When editing is turned on, the job fails. I can manually overwrite the feature layer in AGOL by going to the item's overview page and clicking "Update Data" ==> "Overwrite Entire Layer" but running the overwrite through the ArcGIS Python API doesn't seem to work when editing is turned on. As soon as I uncheck editing in the feature layer settings, the code works again. Not sure what is happening here.
I just noticed you posted this solution 4 years ago and it's still an issue. Just wanted to say thanks for your post as it probably saved me hours of a headache looking for a solution as to why I can't update.
Also, if Sync is enabled this will also throw this error.
hello i just had the same problem.
reuploading the csv cause no problem but publish method with overwrite option fail with the same message.
i solved using the overwrite method on a feature layer collection. exemple in this tuto.
# REPUBLICATION
from arcgis.features import FeatureLayerCollection
import pandas as pd
import json
import os
dataFrame = pd.DataFrame(REFERENTIEL_SERVICES)
dataFrame
filepath = r'./tmp/'
try:
os.mkdir(filepath)
except:
print('dossier existant')
# création du fichier csv depuis le dataframe panda
dataFrame.to_csv(f'{filepath}/ref_services.csv')
entries = os.listdir('tmp/')
print(f'le fichier temporaire {entries} à été correctement créé')
csv_file=filepath+'ref_services.csv'
# la republication doit passer par une feature layer collection, me demandez pas pourquoi...
target_fs = gis.content.search("yourItemId")
flayer_collection = FeatureLayerCollection.fromitem(target_fs[0])
flayer_collection.properties.tables[0].name
flayer_collection.manager.overwrite(csv_file)
# création initiale
# csv_item = gis.content.add({'type':'CSV','title':'REFERENTIEL_COUCHE'},f'{filepath}/out.csv')
# display(csv_item)
# csv_lyr = csv_item.publish({"name":"REFERENTIEL_COUCHE","locationType":"None"})
# csv_lyr
# print(csv_lyr = csv_item.publish({"name":"REFERENTIEL_COUCHE","locationType":"None"}))