snowflake.core.user.UserCollection | Snowflake Documentation (original) (raw)

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, iterate through, and search for users that you have access to in the current context.

Examples

Creating a user instance:

sample_user = User(name="test_user") root.users.create(sample_user)

Attributes

root

The Root object this collection belongs to.

Methods

create(user: UserModel, *, mode: CreateMode = CreateMode.error_if_exists) → UserResource

Create a user in Snowflake account.

Parameters:

Examples

Creating a user, replacing any existing user with the same name:

sample_user = User(name = "test_user") root.users.create(sample_user, mode = CreateMode.or_replace)

create_async(user: UserModel, *, mode: CreateMode = CreateMode.error_if_exists) → PollingOperation[UserResource]

An asynchronous version of create().

Refer to PollingOperation for more information on asynchronous execution and the return type.

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]

iter_async(like: str | None = None, limit: int | None = None, starts_with: str | None = None, from_name: str | None = None) → PollingOperation[Iterator[UserModel]]

An asynchronous version of iter().

Refer to PollingOperation for more information on asynchronous execution and the return type.

keys() → KeysView[str]

values() → ValuesView[T]