Skip to main content

image_repositories

Creates, updates, deletes, gets or lists an image_repositories resource.

Overview

Nameimage_repositories
TypeResource
Idsnowflake.image_repository.image_repositories

Fields

The following fields are returned by SELECT queries:

A Snowflake image repository.

NameDatatypeDescription
namestringA Snowflake object identifier. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME)
database_namestringA Snowflake object identifier. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME)
schema_namestringA Snowflake object identifier. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME)
created_onstring (date-time)Time the image repository was created.
ownerstringIdentifier for the current owner of the image repository.
owner_role_typestringRole type of the image repository owner.
repository_urlstringCurrent URL of the image repository.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_image_repositoriesselectdatabase_name, schema_name, endpointlikeLists the image repositories under a specified database and schema.
fetch_image_repositoryselectdatabase_name, schema_name, name, endpointFetches a named image repository in a specified database and schema.
create_image_repositoryinsertdatabase_name, schema_name, endpointcreateModeCreates an image repository in the specified database, schema, and create mode. The createMode query parameter specifies what action to take based on whether the repository already exists. See the ImageRepository component definition for what is required to be provided in the request body.
delete_image_repositorydeletedatabase_name, schema_name, name, endpointifExistsDeletes an image repository with the given name. If you enable the ifExists query parameter, the operation succeeds even if the object does not exist. Otherwise, a 404 failure is returned if the object does not exist.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
database_namestringIdentifier (i.e. name) for the database to which the resource belongs. You can use the /api/v2/databases GET request to get a list of available databases.
endpointstringOrganization and Account Name (default: orgid-acctid)
namestringIdentifier (i.e. name) for the resource.
schema_namestringIdentifier (i.e. name) for the schema to which the resource belongs. You can use the /api/v2/databases/{database}/schemas GET request to get a list of available schemas for the specified database.
createModestringQuery parameter allowing support for different modes of resource creation. Possible values include: - errorIfExists: Throws an error if you try to create a resource that already exists. - orReplace: Automatically replaces the existing resource with the current one. - ifNotExists: Creates a new resource when an alter is requested for a non-existent resource.
ifExistsbooleanQuery parameter that specifies how to handle the request for a resource that does not exist: - true: The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false: The endpoint throws an error if the resource doesn't exist.
likestringQuery parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.

SELECT examples

Lists the image repositories under a specified database and schema.

SELECT
name,
database_name,
schema_name,
created_on,
owner,
owner_role_type,
repository_url
FROM snowflake.image_repository.image_repositories
WHERE database_name = '{{ database_name }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND like = '{{ like }}';

INSERT examples

Creates an image repository in the specified database, schema, and create mode. The createMode query parameter specifies what action to take based on whether the repository already exists. See the ImageRepository component definition for what is required to be provided in the request body.

INSERT INTO snowflake.image_repository.image_repositories (
data__name,
data__database_name,
data__schema_name,
database_name,
schema_name,
endpoint,
createMode
)
SELECT
'{{ name }}' --required,
'{{ database_name }}',
'{{ schema_name }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}',
'{{ createMode }}'
;

DELETE examples

Deletes an image repository with the given name. If you enable the ifExists query parameter, the operation succeeds even if the object does not exist. Otherwise, a 404 failure is returned if the object does not exist.

DELETE FROM snowflake.image_repository.image_repositories
WHERE database_name = '{{ database_name }}' --required
AND schema_name = '{{ schema_name }}' --required
AND name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND ifExists = '{{ ifExists }}';