Skip to content

[ISSUE] User update incorrectly says user_name is optional #969

Open
@oliverbeagley-pgg

Description

@oliverbeagley-pgg

Description
On v0.53.0 When trying to remove entitlements from users I get the following error: databricks.sdk.errors.platform.BadRequest: invalidValue Required attribute userName is missing in the SCIM Object.

When I fix that I get errors about group attributes not being updated, so I think .update() may be fairly broken in general and/or poorly documented.

Reproduction

from databricks.sdk import WorkspaceClient

wc = WorkspaceClient()

users_with_entitlements = (
    user for user in wc.users.list() if len(user.entitlements) > 0
)

for user in users_with_entitlements:
    wc.users.update(id=user.id, entitlements=[])
Traceback
Traceback (most recent call last):
  File "/tmp/tmp.MJoJmb501l/dbr.py", line 15, in <module>
    wc.users.update(id=user.id, entitlements=[])
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.MJoJmb501l/.venv/lib/python3.13/site-packages/databricks/sdk/service/iam.py", line 4397, in update
    self._api.do("PUT", f"/api/2.0/preview/scim/v2/Users/{id}", body=body, headers=headers)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.MJoJmb501l/.venv/lib/python3.13/site-packages/databricks/sdk/core.py", line 85, in do
    return self._api_client.do(
           ~~~~~~~~~~~~~~~~~~~^
        method=method,
        ^^^^^^^^^^^^^^
    ...<8 lines>...
        response_headers=response_headers,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/tmp/tmp.MJoJmb501l/.venv/lib/python3.13/site-packages/databricks/sdk/_base_client.py", line 196, in do
    response = call(
        method,
    ...<7 lines>...
        auth=auth,
    )
  File "/tmp/tmp.MJoJmb501l/.venv/lib/python3.13/site-packages/databricks/sdk/retries.py", line 57, in wrapper
    raise err
  File "/tmp/tmp.MJoJmb501l/.venv/lib/python3.13/site-packages/databricks/sdk/retries.py", line 36, in wrapper
    return func(*args, **kwargs)
  File "/tmp/tmp.MJoJmb501l/.venv/lib/python3.13/site-packages/databricks/sdk/_base_client.py", line 298, in _perform
    raise error from None
databricks.sdk.errors.platform.BadRequest: invalidValue Required attribute userName is missing in the SCIM Object.

Expected behavior
Not needing to specify user_name if it is truly optional. Type system validation

Other Information

  • OS: ubuntu
  • Version: 0.53.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions