Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE] AccountGroupsAPI has inconsistent names for attributes and returns limited information about the group #797

Open
vmikitchik opened this issue Oct 21, 2024 · 2 comments

Comments

@vmikitchik
Copy link

vmikitchik commented Oct 21, 2024

Description
The result from calling AccountClient.groups.list() returns only the id and display_name fields, the other attributes are None or []. For the members field, I can find it using groups.get() but not groups.list(), so if I want information for members of the groups I need to iterate over all groups using the get?
Additionally, it seems that the names of the fields internally are different from the names you need to use for the attributes= or filter= arguments.

docs followed:
https://databricks-sdk-py.readthedocs.io/en/latest/account/iam/groups.html
https://databricks-sdk-py.readthedocs.io/en/latest/dbdataclasses/iam.html#databricks.sdk.service.iam.Group

Reproduction

  • list() does not return the same info as get() :
from databricks.sdk import AccountClient
from pprint import pprint

act_client = AccountClient(host, account_id, client_id, client_secret)

gg = act_client.groups.list()
for g in gg:
    pprint(g)
# out: members not present 
# Group(display_name='my-group-name',
      # entitlements=[],
      # external_id=None,
      # groups=[],
      # id='00000000000001',
      # members=[],
      # meta=None,
      # roles=[],
      # schemas=None)

sg = act_client.groups.get(id="00000000000001")
pprint(sg)
# out: members present when using get() but not list()
# Group(display_name='my-group-name',
#       entitlements=[],
#       external_id=None,
#       groups=[],
#       id='00000000000001',
#       members=[ComplexValue(display='First Last', ...),
#                ...,
#       ],
#       meta=None,
#       roles=[],
#       schemas=[<GroupSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_GROUP: 'urn:ietf:params:scim:schemas:core:2.0:Group'>])

  • names are different when using args:
  • ex) display name is camelCase when using arg, but snakecase when calling Group.display_name
gg = act_client.groups.list(filter="display_name co 'my-group'")
for g in gg:
    pprint(g)
# out BadRequest: invalidValue Not a valid attribute name/uri

gg = act_client.groups.list(filter="displayName co 'my-group'")
for g in gg:
    pprint(g)
    pprint(g.display_name)
 
# out: successfully finds group
  • attributes arg has same issue and does not work as expected
gg = act_client.groups.list(attributes="id")
for g in gg:
  pprint(g)
# out: same elements as not specifying attributes, with display_name set to None
# Group(display_name=None,
#       entitlements=[],
#       external_id=None,
#       groups=[],
#       id='00000000000001',
#       members=[],
#       meta=None,
#       roles=[],
#       schemas=None)

gg = act_client.groups.list(attributes="id,displayName,members")
for g in gg:
  pprint(g)
# out: display_name now populated, still missing info from groups.get(id)
# Group(display_name='my-group-name',
      # entitlements=[],
      # external_id=None,
      # groups=[],
      # id='00000000000001',
      # members=[],
      # meta=None,
      # roles=[],
      # schemas=None)

Expected behavior

  • Names used in args like attributes and filter should be consistent with the Group output
  • groups.list() should return the same information as groups.get() for the same group

Is it a regression?
Did this work in a previous version of the SDK? If so, which versions did you try?
Tested on 0.33.0 to 0.35.0 and got same results

Debug Logs
The SDK logs helpful debugging information when debug logging is enabled. Set the log level to debug by adding logging.basicConfig(level=logging.DEBUG) to your program, and include the logs here.

Other Information
Version:
Name: databricks-sdk Version: 0.35.0

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@vmikitchik and others