snowflake.core.image_repository.ImageRepositoryCollectionΒΆ
- class snowflake.core.image_repository.ImageRepositoryCollection(schema: SchemaResource)ΒΆ
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ΒΆ
- rootΒΆ
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 ansnowflake.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 is
CreateMode.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)
- 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_respositories = image_repository_collection.iter()
Showing information of the exact image repository you want to see:
>>> image_respositories = image_repository_collection.iter(like="your-image-repository-name")
Showing image repositories starting with βyour-image-repository-name-β:
>>> image_respositories = image_repository_collection.iter(like="your-image-repository-name-%")
Using a for loop to retrieve information from iterator:
>>> for image_repository in image_respositories: >>> print(image_repository.name)
- keys() KeysView[str] ΒΆ
- values() ValuesView[T] ΒΆ