Hello,
I am trying to append an ArcGIS Online layer to an ArcGIS Enterprise layer using a Jupyter Notebook within ArcGIS Pro but I'm faced with the error in the heading.
my code is as follows:
# Get ArcGIS Online Grouped Feature Layer
gis1 = GIS(agol_url, agol_name, agol_pass)
agol_item = gis1.content.get(agol_item_id)
agollyr = agol_item.layers[0]
#Get ArcGIS Enterprise Feature Layer
gis = GIS(ent_url, user_name, password)
group_item = gis.content.get(group_item_id)
grouplyr = group_item.layers
arcpy.env.overwriteOutput = False
ArcGISOnlineLayer = agollyr
ArcGISEnterpriseLayer1 = grouplyr
# Process: Append (Append)
ArcGISEnterpriseLayer = arcpy.Append_management(inputs=[ArcGISOnlineLayer], target=ArcGISEnterpriseLayer1, schema_type="TEST", field_mapping="", subtype="", expression="")
We do not have geoanalytics server hence why I'm doing this work around, very new to python and have hit a brick wall!
It might be that you have not imported arcpy into your notebook.
I haven't played with the notebooks in Pro yet, and I don't know if it automagically imports it for you so I could be wrong but it is my first thought looking at your code.
edit: Also, it might be that you have the schema_type parameter set to Test. from the docs: "TEST —Fields from the input dataset must match the fields of the target dataset. An error will be returned if the fields do not match." If there are any fields with different names between the two, the process will fail.
ok, ... did you try changing the schema from Test to No_Test ?
ArcGISEnterpriseLayer = arcpy.Append_management(inputs=[ArcGISOnlineLayer], target=ArcGISEnterpriseLayer1, schema_type="No_Test")
I have just changed this, i am presented with the same problem, could it be because I'm using hosted layers instead of them being on client?
that being said it works fine if I am running it using the tool within pro.
That could be. You can open up your geoprocessing history and export the successful completion of the tool as a python script. Then compare it to what you have in this script for ideas.
There is also an append in the arcpy for python api that might be what you need to use within Notebooks.
keeping-layers-updated-by-appending-features-using-the-arcgis-api-for-python