databricks / databricks-sdk-py

Databricks SDK for Python (Beta)
https://databricks-sdk-py.readthedocs.io/
Apache License 2.0
318 stars 103 forks source link

[FEATURE] Add totalResults to List() #665

Open danielscamacho opened 1 month ago

danielscamacho commented 1 month ago

Problem Statement List() just return the Objects but the API call gives totalResults and it is ignore and not capture in the sdk. https://docs.databricks.com/api/azure/account/introduction

{ "totalResults": 10, "startIndex": 1, "itemsPerPage": 0, "Resources": [ { "displayName": "someone@example.com", "...": "...", "userName": "someone@example.com", "active": true } ] }

If you want to count the users you need to convert it to a list which takes lot of time if number of users is high

Proposed Solution Add totalResultsproperty for Users and other objects

mgyucht commented 1 month ago

Thanks for this feature request. The SCIM API is a bit unusual compared to other APIs that we have at Databricks in that it has this top-level metadata in list responses. We still need to think about how we can expose this information in the SDK. In the meantime, you should be able to use our internal ApiClient to make a request yourself:

w._api_client.do('GET', f'/api/2.0/accounts/{w._config.account_id}/scim/v2/Users')["totalResults"]