databricks / databricks-sdk-py

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

[ISSUE] client.users.create error #574

Open Katherin07 opened 5 months ago

Katherin07 commented 5 months ago

Description When in a defined function and specific authentication method using WorkspaceClient, the function users.create, throws the error (UsersAPI.create() missing 1 required positional argument: 'id')

Reproduction This is a example of the function:

from databricks.sdk import WorkspaceClient
w = WorkspaceClient()

def create_user_workspace(w, displayname, username):
    try:
        user = w.users.create(display_name=f'{displayname}', user_name=f'{username}')
        print(f"User {displayname}' / '{username}' created correctly.")
        return user
    except Exception as e:
        print(f"Error creating user: {e}")
        raise(e)

Expected behavior The user should be created correctly.

Is it a regression? Im using version of the SDK: databricks-sdk-0.20.0 It's curious that using the same code without the defined function works fine, as shown below:

from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
user = w.users.create(display_name='Name complete', user_name='test@hotmail.com')

However, within the defined function, it fails with the error "UsersAPI.create() missing 1 required positional argument: 'id'".

Debug Logs UsersAPI.create() missing 1 required positional argument: 'id'

mgyucht commented 5 months ago

UsersAPI.create() doesn't have any required positional arguments, and id is optional.

Can you share the full script, where you call create_user_workspace()? Can you also share the exact exception and stack trace?