Select to view content in your preferred language

Arcpy to overwrite layers in AGOL

398
3
01-12-2023 12:42 PM
Laura
by MVP Regular Contributor
MVP Regular Contributor

I had originally posted a group layer from Pro (in an sde) to AGOL

    - I guess my first question is can I overwrite that group layer or do I need to create 11 separate hosted feature layers?

I am trying to write a code that will automatically update these layers in AGOL. I haven't used code before this, so every time I read a document I get a but more puzzled. Wondering if anyone could help me out with these errors? How/where do I need to connect to the server?

I am following: https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/featuresharingdraft-class.htm

 

LauraMott_3-1673556122955.png

 

 

LauraMott_1-1673556078815.png

 

Tags (2)
0 Kudos
3 Replies
MichaelVolz
Esteemed Contributor

Have you thought about a truncate and append process instead of an overwrite.

Check out sample in this thread:

Hosted Feature Layer View Does Not Update When Ove... - Esri Community

The helpful code was generously shared by Josh Carlson and is about half way down the thread.

 

0 Kudos
Laura
by MVP Regular Contributor
MVP Regular Contributor

Thanks, I'll give it a try!

 In terms of the geoaccessor.from_featureclass (path) --> would I have to do this for each layer individually and split my utilities group layer up or can I just use a comma to separate a path to the 11 different utilities under my utility layer in my map?

0 Kudos
MichaelVolz
Esteemed Contributor

I do not know the answer to that question as I was just going to use this code to update individual feature services and not grouped items.  You can try testing to see how it goes and possibly ask this question on the thread I mentioned for the individual who posted the code.

0 Kudos