Hey all,
I was recently given the project to put together a tool that syncs our AGOL environment to our local database and vice versa. This was already created a few years back by another employee but it recent started failing. I found that it was using arcpy.ListFields(SourceLayer) and it now shows that {AGOL_URL} does not exist or is not supported.
I attempted many ideas to get this to continue working with ArcPy, but I've been stuck for a few hours now, and have decided to look back into ArcGIS API for Python to get this completed.
My idea was to bring down the FGDB into a local file, and then use that with ArcPy, but the FGDB is 100+ GB and I cannot do this often. How should I approach this?
Any help is appreciated, thank you!
Cody
Code Snippet:
feature_layer_url = "https://services9.arcgis.com/{identifier}/arcgis/rest/services/{Layer}/FeatureServer/{LayerNum}?token={token}"
for f in arcpy.ListFields(feature_layer_url):
print(f)
Is there a unique field and edit tracking enabled? I would recommend creating a script that:
Be sure your script uses arcpy.SignIntoPortal and you can access the URL of the service without generating a token.
Hey @JakeSkinner
Thank you for the suggestions, unfortunately the issue persists with the Export Features, it still states that it does not exist or is not supported. This is equipped with a unique field along with edit tracking so I'm not entirely sure what the main issue is.
Since this project is somewhat urgent, I ended up just redesigning all the ArcPy functions that were present into ArcGIS API for Python functions, and made this using custom query methods.
If you have any further suggestions I will surely try them, as I enjoy using ArcPy much more than ArcGIS API for Python.
Cody
@CodyPatterson did you include arcpy.SignIntoPortal? Ex:
arcpy.SignIntoPortal('https://www.arcgis.com', 'agolAdmin', 'gis12345')
feature_layer_url = "https://services9.arcgis.com/{identifier}/arcgis/rest/services/{Layer}/FeatureServer/{LayerNum}"
for f in arcpy.ListFields(feature_layer_url):
print(f)
Hey @JakeSkinner
That was present and I confirmed that the credentials were working for login, that unfortunately did not change the outcome.
Cody
Can you share the feature service to an AGOL group and invite my user account (jskinner_rats)? I can take a look.
Hey @JakeSkinner
The feature layer I'm working with is proprietary and cannot be shared out to the public unfortunately, I've created a separate feature layer, which experiences the same issue.
Here's what I see:
Cody
@CodyPatterson try specifying the index number in the Feature Service URL (i.e. /FeatureServer/0).