snowflake.core.managed_account.ManagedAccountCollection

class snowflake.core.managed_account.ManagedAccountCollection(root: Root)

Bases: AccountObjectCollectionParent[ManagedAccountResource]

Represents the collection operations of the Snowflake ManagedAccount resource.

With this collection, you can create, iterate through, and search for managed accounts that you have access to in the current context.

Examples

Creating a managed account instance:

>>> managed_account_collection = root.managed_accounts
>>> managed_account = ManagedAccount(
...     name="managed_account_name",
...     admin_name = "admin"
...     admin_password = 'TestPassword1'
...     account_type = "READER"
...  )
>>> managed_account_collection.create(managed_account)
Copy

Attributes

root

Methods

create(managed_account: ManagedAccountModel) ManagedAccountResource

Create a managed account in Snowflake.

Parameters:

managed_account (ManagedAccount)

Examples

Creating a managed account instance and getting reference to it:

>>> managed_account_parameters = ManagedAccount(
...     name="managed_account_name",
...     admin_name = "admin"
...     admin_password = 'TestPassword1'
...     account_type = "READER"
...  )
>>> # Use the managed account collection created before to create a reference to a managed account resource
>>> # in Snowflake.
>>> managed_account_reference = managed_account_collection.create(managed_account_parameters)
Copy
items() ItemsView[str, T]
iter(*, like: str | None = None) Iterator[ManagedAccountModel]

Iterate through ManagedAccount objects in Snowflake, filtering on any optional like pattern.

Parameters:

like (str, optional) – A case-insensitive string functioning as a filter, with support for SQL wildcard characters (% and _).

Examples

Showing all managed accounts that you have access to see:

>>> managed_accounts = managed_account_collection.iter()
Copy

Showing information of the exact managed account you want to see:

>>> managed_accounts = managed_account_collection.iter(like="your-managed-account-name")
Copy

Showing managed accounts starting with ‘your-managed-account-name-‘:

>>> managed_accounts = managed_account_collection.iter(like="your-managed-account-name-%")
Copy

Using a for loop to retrieve information from iterator:

>>> for managed_account in managed_accounts:
>>>     print(managed_account.name, managed_account.comment)
Copy
keys() KeysView[str]
values() ValuesView[T]