snowflake.core.user.UserCollection

class snowflake.core.user.UserCollection(root: Root)

Bases: AccountObjectCollectionParent[UserResource]

Represents the collection operations on the Snowflake User resource.

With this collection, you can create or update or fetch or list all users that you have access to.

Parameters:

root – A Root instance.

Example

Create a UserCollection instance: >>> role_collection = root.users >>> role_collection.create(new_user)

Attributes

root

Methods

__init__(root: Root) None
create(user: UserModel, *, mode: CreateMode = CreateMode.error_if_exists) UserResource

Create a user in Snowflake account.

Parameters:
  • user – an instance of User.

  • mode

    One of the following enum values.

    CreateMode.error_if_exists: Throw an snowflake.core.exceptions.ConflictError if the

    user already exists in Snowflake. Equivalent to SQL create user <name> ....

    CreateMode.or_replace: Replace if the user already exists in Snowflake. Equivalent to SQL

    create or replace user <name> ....

    CreateMode.if_not_exists: Do nothing if the user already exists in Snowflake. Equivalent to SQL

    create user <name> if not exists...

    Default value is CreateMode.error_if_exists.

Example

Create a snowflake user and get the reference to it: >>> from snowflake.core.user import User >>> sample_user = User(name=”test_user”) >>> user_ref = root.users.create(sample_user)

items() ItemsView[str, T]
iter(like: str | None = None, limit: int | None = None, starts_with: str | None = None, from_name: str | None = None) Iterator[UserModel]
keys() KeysView[str]
values() ValuesView[T]