Select to view content in your preferred language

Append web feature layer in model builder- avoid duplicates

896
2
10-03-2021 10:21 PM
LucileFayolle
Emerging Contributor

I have a model to update the data of a hosted web feature layer.

Problem is: a big part of the 'new' data are identical to the 'already existing' dataset. So, to update the layer and limit the duplicate I use the tool Delete Rows on the web layer, then Append. Just the delete rows takes 10min on my computer and with time the dataset will grow quickly..

Is there an easier and quicker way to append just the new data in the web layer?

May be the use of Dissolve before the Append?

Thanks

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor

Hi @LucileFayolle,

If you export your model to a python script, you can leverage the ArcGIS API for Python.  With this module you can use the truncate method, which is much faster than Delete Rows.  Ex:

 

import arcpy
from arcgis import GIS

# Variables
portal = 'https://portal.esri.com/portal'         # Portal URL
username = 'portaladmin'                          # portal username
password = '********'                             # portal username password
fsItemId = '7b51dcf43c3847ecabf850c607bca967'     # item id of hosted feature service

# Sign Into Portal
gis = GIS(portal, username, password, verify=False)

# Truncate Hosted Feature Service
hostedFlyr = gis.content.get(fsItemId)
fLyr = hostedFlyr.layers[0]
fLyr.manager.truncate()

 

 

0 Kudos
LucileFayolle
Emerging Contributor

Thanks for that!

I never used the ArcGIS API for Python, will give it a try.

I also find a way to script a tool to Overwrite web layer but have some trouble with it, so I may try this.

0 Kudos