snowflake.core.image_repository.ImageRepositoryCollection | Snowflake Documentation (original) (raw)
Bases: SchemaObjectCollectionParent
[ImageRepositoryResource]
Represents the collection operations on the Snowflake Image Repository resource.
With this collection, you can create, iterate through, and search for image repositories that you have access to in the current context.
Examples
Creating an image repository instance:
image_repository = ImageRepository(name="my_image_repository") image_repositories = root.databases["my_db"].schemas["my_schema"].image_repositories image_repositories.create(image_repository)
Attributes
database¶
The DatabaseResource this collection belongs to.
root¶
The Root object this collection belongs to.
Methods
create(image_repository: ImageRepositoryModel, mode: CreateMode = CreateMode.error_if_exists) → ImageRepositoryResource¶
Create an image repository in Snowflake.
Parameters:
- image_repository (ImageRepository) – The
ImageRepository
object, together with theImageRepository
’s properties: name; - mode (CreateMode, optional) –
One of the following enum values.CreateMode.error_if_exists
: Throw an snowflake.core.exceptions.ConflictError if the image repository already exists in Snowflake. Equivalent to SQLcreate image repository <name> ...
.CreateMode.or_replace
: Replace if the image repository already exists in Snowflake. Equivalent to SQLcreate or replace image repository <name> ...
.CreateMode.if_not_exists
: Do nothing if the image repository already exists in Snowflake. Equivalent to SQLcreate image repository <name> if not exists...
Default value isCreateMode.error_if_exists
.
Examples
Creating an image repository, replacing an existing image repository with the same name:
image_repository = ImageRepository(name="my_image_repository") image_repositories = root.databases["my_db"].schemas["my_schema"].image_repositories image_repositories.create(image_repository, mode=CreateMode.or_replace)
create_async(image_repository: ImageRepositoryModel, mode: CreateMode = CreateMode.error_if_exists) → PollingOperation[ImageRepositoryResource]¶
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) → Iterator[ImageRepositoryModel]¶
Iterate through ImageRepository
objects from 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 image repositories that you have access to see:
image_repositories = image_repository_collection.iter()
Showing information of the exact image repository you want to see:
image_repositories = image_repository_collection.iter(like="your-image-repository-name")
Showing image repositories starting with ‘your-image-repository-name-‘:
image_repositories = image_repository_collection.iter(like="your-image-repository-name-%")
Using a for loop to retrieve information from iterator:
for image_repository in image_repositories: print(image_repository.name)
iter_async(*, like: str | None = None) → PollingOperation[Iterator[ImageRepositoryModel]]¶
An asynchronous version of iter().
Refer to PollingOperation for more information on asynchronous execution and the return type.
keys() → KeysView[str]¶
values() → ValuesView[T]¶