Select to view content in your preferred language

cloning: "Failed to create Feature Service <name>: list index out of range"; how to update typeKeyword

1504
2
Jump to solution
11-22-2022 01:21 PM
DavidRichey
Regular Contributor

 Following the guidance at https://developers.arcgis.com/python/guide/cloning-content/ , I have been able to successfully clone items from one organization to another either individually or by identifying a map and cloning the content. When cloning simple feature services, this works fine. When cloning more complex feature collections that are relational databases with great-grandchildren tables, the clone function fails with an error:

IndexError Traceback (most recent call last) c:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self) 3697 ] -> 3698 self._add_features( 3699 new_layers, c:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in _add_features(self, layers, relationships, layer_field_mapping, spatial_reference) 2535 object_id_field = layers[related_layer_id].properties["objectIdField"] -> 2536 object_id_mapping[related_layer_id] = { 2537 related_layer_features[i]["attributes"][ c:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in <dictcomp>(.0) 2538 object_id_field -> 2539 ]: add_results[i]["objectId"] 2540 for i in range(0, len(related_layer_features)) IndexError: list index out of range During handling of the above exception, another exception occurred: _ItemCreateException Traceback (most recent call last) <ipython-input-52-033330901c43> in <module> 1 folder = 'Survey-FFRTD_1_4' ----> 2 FFRTD_1_4_hstdsrvc = target.content.clone_items(items = [FFRTD_1_4_hstdsrvc], folder=folder)

...

-> 3767 raise _ItemCreateException( 3768 "Failed to create {0} {1}: {2}".format( 3769 original_item["type"], original_item["title"], str(ex) _ItemCreateException: ('Failed to create Feature Service FFRTD_1_4: list index out of range', <Item title:"FFRTD_1_4" type:Feature Layer Collection owner:<Ownername)

I am not a skilled programmer, but have looked through the clone class and wonder if the search for related objects does not walk the full path of possible related objects iteratively.

Could this be resolved?

If not, perhaps there could be a method for updating the typeKeyword?

As I could not clone the deep relational databases, I downloaded them using the create replica (with attachments) function off of he REST endpoint. I then uploaded to the destination organization. While this works well, it does not update the typekeyword as the clone function might. This means that attempting to clone objects that rely on the database fail. I would like to be able to update the typeKeyword of the uploaded database, so that parameterizations of maps and apps can be cloned without attempting to clone the (already cloned) relational database. While I can list the typeKeywords from the item after retrieving it with the GIS.get().items for a Feature Service that has been successfully cloned, I cannot find a way to update the typekweyword for an existing layer uploaded as a FGDB.

 

Is it possible to update the typeKeyword attribute of a feature collection through the ArcGIS API?

0 Kudos
1 Solution

Accepted Solutions
JosephRhodes2
Frequent Contributor

Hi David,

It's possible to update typeKeywords through the Sharing API, with https://www.arcgis.com/sharing/rest/content/users/<user>/items/<item_id>/update

...or you can just use AGO Assistant or ArcGIS Assistant.

View solution in original post

0 Kudos
2 Replies
JosephRhodes2
Frequent Contributor

Hi David,

It's possible to update typeKeywords through the Sharing API, with https://www.arcgis.com/sharing/rest/content/users/<user>/items/<item_id>/update

...or you can just use AGO Assistant or ArcGIS Assistant.

0 Kudos
DavidRichey
Regular Contributor

This absolutely worked. I was able to upload the FGDB, modify the type Keyword through AGO Assistant, and the updated keyword was respected by the clone_items method when cloning maps and their feature services.

0 Kudos