Clone_items returns _ItemCreateException #924 - GitHub
文章推薦指數: 80 %
I am attempting to clone a group of items in ArcGIS Online that inclues hosted ... OS: Windows 10; Browser Chrome; Python API Version 3.6.10.
Skiptocontent
{{message}}
Esri
/
arcgis-python-api
Public
Notifications
Fork
941
Star
1.4k
Code
Issues
25
Pullrequests
12
Actions
Projects
0
Wiki
Security
Insights
More
Code
Issues
Pullrequests
Actions
Projects
Wiki
Security
Insights
Newissue
Haveaquestionaboutthisproject?SignupforafreeGitHubaccounttoopenanissueandcontactitsmaintainersandthecommunity.
Pickausername
EmailAddress
Password
SignupforGitHub
Byclicking“SignupforGitHub”,youagreetoourtermsofserviceand
privacystatement.We’lloccasionallysendyouaccountrelatedemails.
AlreadyonGitHub?
Signin
toyouraccount
Jumptobottom
Clone_itemsreturns_ItemCreateException
#924
Closed
ts178409openedthisissue
Feb12,2021
·2comments
Closed
Clone_itemsreturns_ItemCreateException
#924
ts178409openedthisissue
Feb12,2021
·2comments
Assignees
Labels
bug
Comments
Copylink
ts178409
commented
Feb12,2021
Describethebug
Aclearandconcisedescriptionofwhatthebugis.
IamattemptingtocloneagroupofitemsinArcGISOnlinethatinclueshostedfeaturelayers,views,webmaps,andwebapps.Theseitemshaverelationshipclassesbasedonscript-generatedkeysthatpopulatestringfields,suchas'visit_key','survey_key',etc.ThesourceitemshavebeenusedextensivelyandworkwellinArcGISOnline.WewanttoclonethemsowecanstartoverforanewdatacollectionperiodandavoidmanuallyrecreatingalltheseitemsinArcGISOnline.
Whenattemptingtorunthecodebelow,wereceiveanerrorrelatedtoaduplicatekey.Iamunsureifnothavingduplicatefieldnamesthatactasindexesisaknownlimitationofthisfunction,soIamreportinghereasanissue.Itwouldbegreattoknowifthiscanbefixedorifthereisawork-around.
ToReproduce
Stepstoreproducethebehavior:
Createahostedfeaturelayerwithstringindexes.Attempttorunclone_items()functiononit.
#getstokenfromanauthenticatedArcGISProsession,sinceourUSBRAGOLorganizationdoesn'tallow
#user/passauthentication,thisistheeasiestwaytoauthenticatew/AGOL
gis=GIS("pro")
token_response=arcpy.GetSigninToken()
#getsjustthetokenvaluefromthetoken_response
token=token_response['token']
#declareurlofRESTendpointforthesourcefeatureservice
root_def="0daa453f745040529d7bfb2b0633ccfe"
root="eed08fc43d794836a971c80f0cbd1f5a"
wa_view_edit_admin="f00f40b781d9452e9cc5e45e166dd549"
wa_view_edit="87d580dee27247b29cc013c6786451ed"
wm_collect="f5869fb29a244b71abf16ef40c12b568"
wm_collect_backup="6e824e6b2d3b490eb04db60c33322160"
wm_view_edit="db9ac3ceda0f42fd83b8353029135d0e"
wm_view_edit_admin="08039941ef324c5eae06b592dd9621d0"
wm_view_edit_all="89a246059177489095f4b110ab53b665"
fsv_root_filter="00739ef8d1a44667b5372a4624c3d6d7"
fsv_root_view_edit_own="b238cd73cf2948dba0f34850e7c5bfe0"
fsv_root_view_edit_own_filter="c4d3a090f23e43808f10518008c7f3ab"
fsv_simple_symbology="8b41f4547d6b49ac9d65cdd9302eb24c"
item=gis.content.get(wa_view_edit_admin)
#item_id_list=[root_def,root,wa_view_edit_admin,wa_view_edit,wm_collect,wm_collect_backup,wm_view_edit,wm_view_edit_admin,wm_view_edit_all,
#fsv_root_filter,fsv_root_view_edit_own,fsv_root_view_edit_own_filter,fsv_simple_symbology]
#item_list=[]
#foritem_idinitem_id_list:
#item=gis.content.get(item_id)
#print(item)
#item_list.append(item)
#clone_items(items,folder=None,item_extent=None,use_org_basemap=False,copy_data=True,copy_global_ids=False,search_existing_items=True,item_mapping=None,group_mapping=None,owner=None)
clone_list=gis.content.clone_items([item],folder='CloneTest')
error:
_ItemCreateException:("FailedtocreateFeatureServiceF02_BPM_2021_FS_root:Unabletoaddfeatureservicedefinition.\nTheoperationfailedbecauseanindexorstatisticswithname'visit_key_unidx'alreadyexistsontable'db_3473.user_3473.F02_BPM_2020_FS_root_467e4b9333484d0696427a05a9377426_VISIT'.\n(ErrorCode:400)",
延伸文章資訊
- 1arcgis.gis module | ArcGIS API for Python
This module, the most important in the ArcGIS API for Python, ... The clone_items method is used ...
- 2How To: Copy/clone content from one ArcGIS Online ...
Procedure. The following Python script (run from a Jupyter Notebook interface) uses the clone_ite...
- 3ago-clone-items/clone_items.py at master - GitHub
Tools used to clone items between ArcGIS Online and ArcGIS Enterprise organizations ... Represent...
- 4Solved: Can you use clone_items to move items from one por...
You can use the Python API to deep clone items and their dependencies using "clone_items" like th...
- 5Arcgis python api clone items. 1K 27 The code runs and the ...
Arcgis python api clone items. ... in ArcGIS API for Python or the ArcGIS REST API: The cloning c...