I can't seem to find the correct syntax for the layer_mappings parameter of append. I checked the API reference and I've got the argument name right, however, the line below throws TypeError: append() got an unexpected keyword argument 'layer_mappings'
fLyr.append(fgd_item, upload_format="featureService", layer_mappings=[{"id": 3, "sourceId": 0}])
I also checked the REST API syntax too but that didn't seem to help. Anyone used this parameter before?
curious, since the syntax in your link shows
layerMappings=[{“id”: <layerID>, “sourceId”: <layer id>}]
Yeah I can't figure it out, since the help shows both
I've tried that other way as well and get the same TypeError: append() got an unexpected keyword argument 'layerMappings'
fLyr.append(fgd_item, upload_format="featureService", layerMappings=[{"id": 3, "sourceId": 0}])
Hi @oregonparksgis,
I see you are using upload_format="featureService", is this correct since your item_id parameter is fgd_item, are you attempting to append from a File Geodatabase? If so change to upload_format="filegdb".
You then use the source_table_name parameter to get the data from the source feature class in the gdb and append to the feature layer. You can only do one layer at a time from a gdb, but you could use a for loop to do all your layers with a single script.
You might be getting the error: TypeError: append() got an unexpected keyword argument 'layer_mappings' because it is detecting a gdb rather than a feature service and the layer_mappings parameter is only available when appending from a Feature Service to Feature Service and not from File Geodatabase to Feature (Layer) Service.
On the other hand, if your source is indeed a Feature Service, then I am at a loss 😅
All the best,
Glen
Thanks @Clubdebambos,
Unfortunately I am indeed trying to update using a Feature Service after all attempts to use an fgdb that is an existing item in agol have failed. The variable name in my code snip is an artifact of those attempts.
In the Feature Service case, manually entering the parameters from the REST endpoint interface works fine.
https://services.arcgis.com/********/ArcGIS/rest/services/******/FeatureServer/3/append?token=******
So the issue appears to me to just be the python syntax. I've opened a support ticket so we'll see if that gets it resolved.
Went to Kudo on my phone and accidentally hit accept as solution! Ah well 🤣