Overwrite Or Append a web feature layer Arcpy, ArcGIS Pro

2331
11
04-05-2020 07:36 AM
HushamMohamed
Occasional Contributor

I have a dynamic query layer (polygon) derived from feature class and SQL table, I was able to share it to ArcGIS Online as a web layer.

1-  I would like to setup an automated workflow for overwriting or append to hosted feature services within our ArcGIS Online Account (stand alone arcpy script) and schedule that for everyday update. I tried this one Update Hosted Feature Service with Feature Class but got this error. I am not interested using Python API, 

 

2- Where is the path of Query Layer (workspacePath) ?  I know its generated and already shared to ArcGIS Online.

3- also I went through this one Best Practise for scripting updating of hosted feature services?

  but none of  them helped. 

0 Kudos
11 Replies
HushamMohamed
Occasional Contributor

2- Where is the path of Query Layer (workspacePath) 

I checked its Data source Path, nothing on the DB. 

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Hi Husham,

The easiest approach would be to create a model and run the Delete Rows to delete all the records from the feature service, and then execute the Append tool to append features from a feature class to the feature service. 

Once you have the model created, you can set this up to run at a prescribed time.  See the following help document on how to do this using ArcGIS Pro 2.5:

Schedule geoprocessing tools—ArcGIS Pro | Documentation 

HushamMohamed
Occasional Contributor

Thank you, Will try this easiest approach. and get back to you.

0 Kudos
HushamMohamed
Occasional Contributor

I created the Model for deleting and Appending,

 

and It work Perfect,  the problem now with the Schedule,I keep getting this error. I am not Sure Is windows related or ArcGIS Pro issue.

0 Kudos
JakeSkinner
Esri Esteemed Contributor

As an alternative, you can export the model to a python script, and then try configuring Windows Task Scheduler to execute the script:

https://community.esri.com/docs/DOC-14675-schedule-a-python-script-using-windows-task-scheduler 

0 Kudos
HushamMohamed
Occasional Contributor

this exactly what I did, any how will figure it out, my main issue now is how to set the time field 

because the append now reset the date/time field to UTC -5,  while I need it to be UTC -6 Central Time. 

0 Kudos
JasonSimpson
New Contributor III

Have you tried the convert time geoprocessing tool? I had this issue a few weeks back and had to incorporate this tool into my process. Not sure if this helps you, but it worked for me. 

0 Kudos
HushamMohamed
Occasional Contributor

Did not worked for me, did your original date/time with your local time Like my Case?

Thanks

0 Kudos
HushamMohamed
Occasional Contributor

Hi Jake,

I've created  a model its working fine when I run it from the Model Builder - ArcGIS Pro, but which fails when it is scheduled.  In the Windows Scheduler window I get a (0x1) "Last Run Result" status.  Apparently when working with hosted layers it isn't as simple as it sounds. 

Could you provide a simple example of how to create a model that interacts with a hosted feature class with windows Scheduler.

When you get time, I posted few questions here, still looking for answers.

Thanks

0 Kudos