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)
Copy

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 the ImageRepository’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 SQL create image repository <name> ....

    CreateMode.or_replace: Replace if the image repository already exists in Snowflake. Equivalent to SQL create or replace image repository <name> ....

    CreateMode.if_not_exists: Do nothing if the image repository already exists in Snowflake. Equivalent to SQL create 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)
Copy
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()
Copy

Showing information of the exact image repository you want to see:

>>> image_respositories = image_repository_collection.iter(like="your-image-repository-name")
Copy

Showing image repositories starting with β€˜your-image-repository-name-β€˜:

>>> image_respositories = image_repository_collection.iter(like="your-image-repository-name-%")
Copy

Using a for loop to retrieve information from iterator:

>>> for image_repository in image_respositories:
>>>     print(image_repository.name)
Copy
keys() β†’ KeysView[str]ΒΆ
values() β†’ ValuesView[T]ΒΆ