Create an Overwrite tool by combining Delete Rows and Append tools for ModelBuilder

1004
5
07-15-2022 02:44 PM
Status: Open
Labels (1)
RyanBohan
Occasional Contributor III

Combine Delete Rows and Append tools to make a single Overwrite tool to be used in ModelBuilder.  (a no code solution)

For background I have a Hosted Feature Layer, that is overwritten daily.  The data is coming from a CSV that gets processed in ModelBuilder.

RyanBohan_0-1657921015791.png

1st Delete Rows removes all records from the Hosted Layer

RyanBohan_1-1657921015794.png

2nd Append the Hosted_Feature_Layer with the processed Feature_Layer_Temp

RyanBohan_3-1657921395599.png

Every time the model runs the entire Hosted Feature Layer is refreshed with new data from the processed CSV.  The Hosted Layer id stays the same, so no need to reconfigure anything consuming he layer.

  The only downside is the ObjectID increased every time the model is run. 

I would love to see the Delete Rows and Append combined in a single Overwrite tool.  Perhaps improving the ObjectID issue.

5 Comments
KoryKramer

Our sharing team published this blog with a sample of how to overwrite in a model https://www.esri.com/arcgis-blog/products/arcgis-pro/mapping/publish-and-overwrite-web-layers-in-mod...

For what you're describing though, have you simply tried using the Truncate Table tool rather than Delete Rows? https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/truncatetable.htm 

That will solve your stated problem of the objectid not resetting (as long as it works on your hosted feature service).

 

 

 

RyanBohan

Hi Kory,

Thank you for the quick response, we are on portal 10.8.1 and have previously ran into a bug after 4-6 weeks of a daily overwrite that completely corrupts a hosted feature layer.  We believe this has been fixed in 10.9.1 however while in the works, the upgrade will take us a while. https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDEzMTM2Ng==

Thank for the tip on the Truncate Table Tool, sadly "This tool does not support a feature service layer as input." until Pro 3.0.  With some Pro 3.0 files not being backwards compatible, as an organization we will need to plan the upgrade careful to bring everyone up to Pro 3.x at the same time.

KoryKramer
Status changed to: Already Offered

Thanks for the additional details, Ryan. You're right, it looks like the ability to Truncate a feature service was added in ArcGIS Pro 3.0. So hopefully once you're able to upgrade, that will provide the solution you're looking for. 

Be sure to thoroughly review https://www.esri.com/arcgis-blog/products/arcgis-pro/announcements/get-ready-for-arcgis-pro-3-0/ and the referenced migration documentation if you have not already (sounds like maybe you have which is good)!

Cheers

BruceHarold

Ryan if you have Data Interoperability extension you can refresh your target layer with a changes-only data set, let me know if that if of interest.

RyanBohan

Hi Bruce,

  Great idea, I will check if we have any Data Interoperability licenses available.  Only updating changes sounds much cleaner process, and will improve time on the larger datasets.