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, 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ΒΆ
Methods
- create(user: UserModel, *, mode: CreateMode = CreateMode.error_if_exists) UserResource ΒΆ
Create a user in Snowflake account.
- Parameters:
user (User) β The
User
object, together with theUser
βs properties: name; password, login_name, display_name, first_name, middle_name, last_name, email, must_change_password, disabled, days_to_expiry, mins_to_unlock, default_warehouse, default_namespace, default_role, default_secondary_roles, mins_to_bypass_mfa, rsa_public_key, rsa_public_key_fp, rsa_public_key_2, rsa_public_key_2_fp, comment, type, enable_unredacted_query_syntax_error, network_policy are optionalmode (CreateMode, optional) β
One of the following enum values.
CreateMode.error_if_exists
: Throw ansnowflake.core.exceptions.ConflictError
if the user already exists in Snowflake. Equivalent to SQLcreate user <name> ...
.CreateMode.or_replace
: Replace if the user already exists in Snowflake. Equivalent to SQLcreate or replace user <name> ...
.CreateMode.if_not_exists
: Do nothing if the user already exists in Snowflake. Equivalent to SQLcreate user <name> if not exists...
Default is
CreateMode.error_if_exists
.
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)
- 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] ΒΆ