Hello,
I am trying to Append data from a feature class in a file geodatabase using API for Python.
In the past I had used ArcPy, however the process of doing so is slow and ESRI staff had suggested using API for Python instead. I have been trying to test a few option and keep failing to do so successfully.
This is my current attempt, however I keep getting an error stating:
TypeError: append() got an unexpected keyword argument 'input_source'
I have removed my credentials and masked my domain info for obvious reasons.
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
# Step 1: Connect to your GIS
gis = GIS("", "", "")
# Step 2: Access the hosted feature layer
feature_layer_url = "https://xyzxyz.xyzxyz.com/server/rest/services/Hosted/hailDB/FeatureServer/0"
feature_layer = FeatureLayer(feature_layer_url)
# Step 3: Append new features from a file geodatabase
gdb_path = r"D:\gisData\services\hail\data\hailDB_update.gdb"
feature_class_name = "hail_update"
# Construct the input source URL for the file geodatabase
input_source = f"{gdb_path}/{feature_class_name}"
# Use the append method
append_result = feature_layer.append(item_id=None, upload_format="filegdb", source_table_name=feature_class_name, upsert=False, input_source=input_source)
# Step 4: Check the result
if append_result:
print("Features appended successfully!")
else:
print("Failed to append features.")
If I change line 19 to use an uploaded file geodatabase within my Portal environment with this code:
success = append_result = feature_layer.append(item_id='xxxxxxxxxxxxxxxxxxxx...', upload_format="filegdb", upsert=False, source_table_name=feature_class_name)
I get an error stating: Operation Failed
I have verified that the Spatial References are the same.
Any ideas or examples on what has worked for others?
Thanks,
George