Hello, I'm attempting to add a new entity type to my graph schema using the named_object_type_adds method of the arcgis.graph.KnowledgeGraph class but am receiving the following error:
File /opt/conda/envs/arcgis/lib/python3.11/site-packages/arcgis/graph/_service.py:732, in KnowledgeGraph.named_object_type_adds(self, entity_types, relationship_types) 729 for relationship_type in relationship_types: 730 r_enc.add_relationship_type(relationship_type) --> 732 r_enc.encode() 733 error = r_enc.get_encoding_result().error 734 if error.error_code != 0: TypeError: encode(): incompatible function arguments. The following argument types are supported: 1. (self: GraphEncoder) -> None Invoked with: <arcgis.graph._arcgisknowledge.GraphNamedObjectTypeAddsRequestEncoder object at 0x7fced37e5170>
For context, my Knowledge Server is version 11.3 and running on a Linux OS (alongside a base ArcGIS Enterprise setup which federates the Knowledge Server). I am calling the command from a Jupyter Notebook server running on ESRI's docker container (ghcr.io/esri/arcgis-python-api-notebook). I'm able to authenticate fine (gis = GIS(username=xyzxy, password=xyzxy)) and can confirm I have the necessary rights to create and edit graphs (role: org_admin). I am also able to make graphs, and add entities where their type already exists (i.e., Document entities which are created when the KG is made). Despite this, I cannot edit the graph's schema.
I am able to use the same entity_type definition in an ArcGIS Pro-hosted/authenticated session on a Azure-hosted graph, so I'm fairly certain it isn't the entity_type syntax. I'm also confident it isn't related to authentication as I am able to make new KGs, delete them and add entities where their type exists. My hunch is it relates to the ArcGIS Python API (2.4.0).
Has anyone else had this issue?
My next steps will be to downgrade the ArcGIS Python API, and maybe try on Enterprise 11.2.
Nick
Hello, we recently discovered and fixed this bug which prevents data model (schema) editing specifically when the python script is run in a Linux environment. It will be fixed in the next release of the Python API so the workaround would be to use an older version for now.
Thanks @MeganBanaski1. I can confirm version 2.1.0 of the ArcGIS Python API lets you edit the graph schema (tested using ESRI's Docker deployment of the Python API). There are a few drawbacks of other functionality not being present (query_streaming), but I've yet to come across anything that can't be worked around.
Looking forward to version 2.5!