ArcPy Append Error: Object: Error in executing tool

919
5
01-28-2021 07:33 AM
schwad
by
New Contributor II

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!

0 Kudos
5 Replies
by Anonymous User
Not applicable

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: "TESTFields 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.

0 Kudos
schwad
by
New Contributor II
I have imported arcpy... it's not that
0 Kudos
by Anonymous User
Not applicable

ok, ... did you try changing the schema from Test to No_Test ?

 

ArcGISEnterpriseLayer = arcpy.Append_management(inputs=[ArcGISOnlineLayer], target=ArcGISEnterpriseLayer1, schema_type="No_Test")

 

0 Kudos
schwad
by
New Contributor II

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.

0 Kudos
by Anonymous User
Not applicable

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.

Append 

keeping-layers-updated-by-appending-features-using-the-arcgis-api-for-python 

0 Kudos