Query UrbanDesignDatabase UpgradeStatus

393
3
Jump to solution
11-28-2023 02:02 PM
MaximeDemers
Occasional Contributor III

Hi,

I am using the Urban API with python. I would like to get a list of all UrbanDesignDatabases within a UrbanModel that have an upgrade available.

 

I am trying to build the query that  filter the design databases where the upgrade_status field of the upgrade_info is "UpgradeAvailable". I am following the sgqlc documentation: https://sgqlc.readthedocs.io/en/latest/sgqlc.operation.html#sgqlc.operation.Operation

 

 

    endpoint = HTTPEndpoint(endpoint_url,  {"Authorization": "Bearer " + token})
    op = Operation(schema.Query, limit=int, offset=int)
    design_db = op.urban_model(urban_model_id=urban_model_id).urban_design_databases(limit=Variable("limit"), offset=Variable("offset"))
    design_db.title()
    design_db.upgrade_info(upgrade_status="UpgradeAvailable")

 

 

The last line returns KeyError: 'upgrade_status'

 

I have tried using a filter like this, but I have KeyError: 'filter'

 

 

    design_db.upgrade_info(filter={"upgrade_status": "UpgradeAvailable"})

 

 

Is there a way to build queries with filters or do I have to query all the design databases and do the filtering on the client side?

 

Thank you

 

 

1 Solution

Accepted Solutions
AgnieszkaRozniak
Esri Contributor

Hi Maxime, 

thank you for your question. Unfortunately, there is no filtering implemented on the upgrade_info field in the Urban API.

To explore filters available for different operations and fields, you can use the docs tab in the graphiql interface, available at https://urban-api.arcgis.com/graphql. 

For example, the following filters (in purple) are available for the UrbanDesignDatabases query: 

AgnieszkaRozniak_0-1701429040779.png

Sometimes, filters are also implemented on the field level, for example you can filter thumbnail field by the size.

AgnieszkaRozniak_1-1701429284791.png

However, if you search for the upgradeInfo field, you can see that no filters are available. 

AgnieszkaRozniak_2-1701429456342.png

 

For your current issue, I would suggest filtering the returned query response and finding the GlobalIds of the urbanDesignDatabases that require the upgrade. 

Please let me know if you have any further questions. 

 

View solution in original post

3 Replies
MaximeDemers
Occasional Contributor III

I have modified my first post as it was containing erroneous code sample

0 Kudos
AgnieszkaRozniak
Esri Contributor

Hi Maxime, 

thank you for your question. Unfortunately, there is no filtering implemented on the upgrade_info field in the Urban API.

To explore filters available for different operations and fields, you can use the docs tab in the graphiql interface, available at https://urban-api.arcgis.com/graphql. 

For example, the following filters (in purple) are available for the UrbanDesignDatabases query: 

AgnieszkaRozniak_0-1701429040779.png

Sometimes, filters are also implemented on the field level, for example you can filter thumbnail field by the size.

AgnieszkaRozniak_1-1701429284791.png

However, if you search for the upgradeInfo field, you can see that no filters are available. 

AgnieszkaRozniak_2-1701429456342.png

 

For your current issue, I would suggest filtering the returned query response and finding the GlobalIds of the urbanDesignDatabases that require the upgrade. 

Please let me know if you have any further questions. 

 

MaximeDemers
Occasional Contributor III

Hi @AgnieszkaRozniak,

Thank you very much for the info, I was not aware the filters was listed like that in the documentation.

That will help a lot for future usages.

Have a nice day