Select to view content in your preferred language

Append Features From AGOL service to GDB

237
1
08-30-2022 10:32 AM
XavierRouxRacine1
New Contributor

Hello, I need to add feature from AGOL service to a GDB using the append function of Arcpy. I need to run that from a python script absolutely. Here is my line of code 

 

result = arcpy.management.Append(Feature url , gdbPath, "NO_TEST", params, '', '')

It's work fine in ArcGIS Pro, but not when I run my python code. It's return me the error 00732.

Here are the error messages I got : 

 

 

syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: <html^ lang="en"><head> <title>Home</title> <link href='/ESRI.ArcGIS.SDS.REST.css' rel='stylesheet' type='text/css'> <link rel='SHORTCUT ICON' href='/favicon.ico'><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="keywords" content="ArcGIS REST Services Directory Root"></head><body><table width="100%" id="userTable" class="userTable"><tr><td class="titlecell">ArcGIS REST Services Directory</td></tr></table><table id="navTable" class="navTable" width="100%"><tbody><tr valign="top"><td class="breadcrumbs"><span id="homeBreadcrumbs"><a href="/0o8QNvTvT8ZVNsRw/ArcGIS/rest/services">Home</a> > <a href="/0o8QNvTvT8ZVNsRw/ArcGIS/rest/services">services</a> </span></td><td align="right"> | <a href="http://resources.arcgis.com/en/help/arcgis-rest-api/" target="_blank">API Reference</a></td></tr></tbody></table><div id="jsonLinkTable"><table><tr><td class="apiref"><a href="?f=pjson" target="_blank">JSON</a></td></tr></table></div><div class='restHeader'><h2>Home</h2></div><div class='restBody'><div class="restErrors">Token Required<br/></div></div></body></html>
Traceback (most recent call last):

arcgisscripting.ExecuteError: Échec de l’exécution. Les paramètres ne sont pas valides.
ERROR 000732: urlService doesn't exist or not take in charge
Échec de l’exécution de (Append). 

 

Thank you for the help

0 Kudos
1 Reply
RhettZufelt
MVP Notable Contributor

This is working for me to do just that:

import arcpy
arcpy.env.preserveGlobalIds = True


Signs = r'Database Connections\SignsDatabase.sde\SignsDatabase.DBO.Signs'

L0Sign = r"https://services3.arcgis.com/asdfsagasdfsd/ArcGIS/rest/services/hostedfeaturelayer/FeatureServer/0"

SignTable =  arcpy.FeatureSet()
SignTable.load(L0Sign)

 
       
with arcpy.EnvManager(preserveGlobalIds=True, scratchWorkspace=r"C:\SSA\SSA_project\Default.gdb", workspace=r"C:\SSA\SSA_project\Default.gdb"):

       Signs = arcpy.management.Append(inputs=[L0Sign], target=Signs, schema_type="TEST", field_mapping="", subtype="", "")[0]

R_

 

0 Kudos