Hi Brains Trust. I've given up trying to figure this out on my own. I know that the arcpy Append GP tool will normally let me append data from a feature class to a feature service. However, when running the below code I keep getting the error displayed. Can anyone give me any pointers? I've tried working with Copilot, and also with different methods (e.g. da.updatecursor) but that doesn't work with feature services.
# Step 9: Compare and update Post_Planting_Inspection_Tracking_Base
print("Step 9: Comparing and updating Post_Planting_Inspection_Tracking_Base...")
arcpy.management.Append(
inputs=update_data,
target=post_planting_layer,
schema_type="NO_TEST",
field_mapping=r'Plantation "Plantation" true true false 50 Text 0 0,First,#,C:\temp\scratch.gdb\update_data,Plantation,0,50;Forest "Forest ID" true true false 6 Text 0 0,First,#,C:\temp\scratch.gdb\update_data,Forest,0,6;Species "Species" true true false 20 Text 0 0,First,#,C:\temp\scratch.gdb\update_data,Species,0,20;PlantingYear "Planting Year" true true false 0 Long 0 0,First,#,C:\temp\scratch.gdb\update_data,PlantingYear,-1,-1;RENDER_LABEL "Tenure" true true false 255 Text 0 0,First,#,C:\temp\scratch.gdb\update_data,RENDER_LABEL,0,50;PlantingFinished "Planting Finished" true true false 0 Date 0 0,First,#,update_data,MAX_FinishDate,-1,-1',
subtype="",
expression="",
match_fields="Plantation Plantation;Forest Forest;Species Species;PlantingYear PlantingYear;PlantingFinished MAX_FinishDate;RENDER_LABEL RENDER_LABEL",
update_geometry="UPDATE_GEOMETRY"
)
print("Features added/updated - process complete!")
Step 9: Comparing and updating Post_Planting_Inspection_Tracking_Base...
Traceback (most recent call last):
File "C:\Temp\Upload FPC416 Polygons.py", line 130, in <module>
arcpy.management.Append(
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 7306, in Append
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 7303, in Append
retval = convertArcObjectToPythonObject(gp.Append_management(*gp_fixargs((inputs, target, schema_type, field_mapping, subtype, expression, match_fields, update_geometry), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool
>>>