Hi there,
I have a number of ArcGIS Online Notebooks that leverage the Urban API to maintain my Urban models. Today I discovered that they are no longer functional, and error out when attempting to import the Urban API as a Python module. (Specifically they return ValueError: Schema already has Time=Time). I have not made any changes to the code, leading me to believe the issue may be being caused by a recent update to the API.
For ease of testing, I've created a public version of the first few cells of these Notebooks so you can test the issue. The third cell returns the error for me when run:
arcgis.com/home/item.html?id=33d1a0aabb6d498cb52dde98b8bb9809
Thanks in advance for the help!
Solved! Go to Solution.
Hi Ridley,
We found the cause of the ValueError. We added a type 'Time' to our schema which leads to this error, as by default the generated code for the schema includes some time-related utility types.
Solution:
Add the following argument to the sgql generator: '--exclude-default-types=Time'
New sgql generator code:
!sgqlc-codegen schema --exclude-default-types=Time urban_api_schema.json urban_api_schema.py
This solves the error for me. We will also adjust the documentation to include this.
Hi Ridley,
thank you for reporting this. I was able to reproduce the error and our team will have a look at this. I will get back to you as soon as we fixed the issue.
Let us know if you have any other questions.
Hi Ridley,
We found the cause of the ValueError. We added a type 'Time' to our schema which leads to this error, as by default the generated code for the schema includes some time-related utility types.
Solution:
Add the following argument to the sgql generator: '--exclude-default-types=Time'
New sgql generator code:
!sgqlc-codegen schema --exclude-default-types=Time urban_api_schema.json urban_api_schema.py
This solves the error for me. We will also adjust the documentation to include this.
Hi Thierry,
Thank you for following up and for the solution - just confirming this works on my end.
Have a great week!
Ridley