Skip to main content

artifact_repositories

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

Overview​

Nameartifact_repositories
TypeResource
Idsnowflake.apps.artifact_repositories

Fields​

The following fields are returned by SELECT queries:

successful

NameDatatypeDescription
namestringName of the artifact repository (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
database_namestringDatabase in which the artifact repository is stored (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
schema_namestringSchema in which the artifact repository is stored (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
api_integrationstringLink to an integration object
commentstringuser comment associated to an object in the dictionary
created_onstring (date-time)Date and time when the artifact repository was created.
ownerstringRole that owns the artifact repository (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
owner_role_typestringThe type of role that owns the artifact repository (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
typestringSpecifies the type of the repository. The only current supported option is ‘PIP’. (PIP)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectdatabase_name, schema_name, name, endpointFetch an artifact repository
listselectdatabase_name, schema_name, endpointlike, startsWith, showLimit, fromNameList artifact repositories
createinsertdatabase_name, schema_name, endpoint, name, type, api_integrationcreateModeCreate an artifact repository
create_or_alterreplacedatabase_name, schema_name, artifact_repository_name, endpoint, name, type, api_integrationCreate or update an artifact repository
deletedeletedatabase_name, schema_name, name, endpointifExistsDelete an artifact repository
renameexecdatabase_name, schema_name, name, targetName, endpointifExists, targetDatabase, targetSchemaChanges the name of an artifact repository

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
artifact_repository_namestringIdentifier (i.e. name) for the resource.
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 identifier (orgname-accountname) (default: orgname-accountname)
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.
targetNamestringName of the target resource.
createModestringParameter 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.
fromNamestringParameter to enable fetching rows only following the first row whose object name matches the specified string. Case-sensitive and does not have to be the full name.
ifExistsbooleanParameter 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.
likestringParameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.
showLimitintegerParameter to limit the maximum number of rows returned by a command.
startsWithstringParameter to filter the command output based on the string of characters that appear at the beginning of the object name. Uses case-sensitive pattern matching.
targetDatabasestringDatabase of the target resource. Defaults to the source's database
targetSchemastringSchema of the target resource. Defaults to the source's schema

SELECT examples​

Fetch an artifact repository

SELECT
name,
database_name,
schema_name,
api_integration,
comment,
created_on,
owner,
owner_role_type,
type
FROM snowflake.apps.artifact_repositories
WHERE database_name = '{{ database_name }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND name = '{{ name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
;

INSERT examples​

Create an artifact repository

INSERT INTO snowflake.apps.artifact_repositories (
name,
type,
comment,
api_integration,
database_name,
schema_name,
endpoint,
createMode
)
SELECT
'{{ name }}' /* required */,
'{{ type }}' /* required */,
'{{ comment }}',
'{{ api_integration }}' /* required */,
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}',
'{{ createMode }}'
RETURNING
status
;

REPLACE examples​

Create or update an artifact repository

REPLACE snowflake.apps.artifact_repositories
SET
name = '{{ name }}',
type = '{{ type }}',
comment = '{{ comment }}',
api_integration = '{{ api_integration }}'
WHERE
database_name = '{{ database_name }}' --required
AND schema_name = '{{ schema_name }}' --required
AND artifact_repository_name = '{{ artifact_repository_name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND name = '{{ name }}' --required
AND type = '{{ type }}' --required
AND api_integration = '{{ api_integration }}' --required
RETURNING
status;

DELETE examples​

Delete an artifact repository

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

Lifecycle Methods​

Changes the name of an artifact repository

EXEC snowflake.apps.artifact_repositories.rename
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@targetName='{{ targetName }}' --required,
@endpoint='{{ endpoint }}' --required,
@ifExists={{ ifExists }},
@targetDatabase='{{ targetDatabase }}',
@targetSchema='{{ targetSchema }}'
;