FeatureLayerManager add_to_definition is not uploading the json properly for relationships

12-08-2020 11:05 AM


I have a hosted feature layer with some standalone tables as well. I need to have relationships between the tables and apparently using Add Relate in ArcGIS Pro does not affect a published hosted feature layer at all and the relationships are missing. Instead, I wrote a short notebook that gets the layer and tables, and calls add_to_definition on each one adding the proper json to represent the relationship, for example: 

It returns True, so the json does get uploaded, but when I view the layer json kin the browser, it has the correct data in the relationships array except the keyField is empty. The data tab show the related table column, but it is always empty because of the missing relationship field. This is what the json looks like in the browser for the same example:


"relationships": [
"id": 1,
"name": "parcel2structures",
"relatedTableId": 1,
"cardinality": "esriRelCardinalityOneToMany",
"role": "esriRelRoleOrigin",
"keyField": "",
"composite": false



Unfortunately, there does not seem to be any way to edit relationships in any way in Pro or in ArcGIS Online, so I am stuck trying to forcefully edit json and the json won't even update properly. I am stuck on this and I really need the relationships to work here for my application.

Perhaps this is an issue with the REST API, given that the python functions here are clearly just calling the REST API.

Any help would be greatly appreciated.




0 Kudos
0 Replies