Dear Community,
I want to copy the features from a SDE to a hosted feature layer on AGOL.
My sample so far looks like:
import arcgis
import arcpy
from arcgis import GIS
from arcgis.features import FeatureLayer, FeatureSet
fc = r"C:\Sample.sde\SAMPLE.POLY_SAMPLE"
fields = [field.name for field in arcpy.ListFields(fc)]
fields[fields.index("SHAPE")] = "SHAPE@"
user = "???"
password = "???"
item_id = "???"
gis = GIS(r"https://???.maps.arcgis.com/", user, password)
data_id = gis.content.get(item_id)
print(data_id)
layer = FeatureLayer.fromitem(item=data_id, layer_id=0)
print(layer)
layer.manager.truncate()
feature_set = arcpy.FeatureSet()
feature_set.load(fc)
print(feature_set.JSON)
result = layer.edit_features(adds=???)
print(result)
First of all I delete all features from the hosted feature layer on AGOL.
Next I want to add the features from the SDE feature layer to the hosted feature layer ...
My problem is, that I couldn't find a real working sample for this.
Does anyone have a working sample how to do it?
Regards,
Daniel.