CREATE ARTIFACT REPOSITORY

Creates a new artifact repository in the current or specified schema, or replaces an existing artifact repository. An artifact repository stores versioned packages that are used by downstream Snowflake objects. Two repository types are supported:

  • APPLICATION: stores packaged application builds that an CREATE APPLICATION SERVICE deploys.
  • PYPI: stores Python packages resolved from an external Python package index through an API integration.
See also:

ALTER ARTIFACT REPOSITORY , DESCRIBE ARTIFACT REPOSITORY , DROP ARTIFACT REPOSITORY , SHOW ARTIFACT REPOSITORIES

Syntax

CREATE [ OR REPLACE ] ARTIFACT REPOSITORY [ IF NOT EXISTS ] <name>
  TYPE = { APPLICATION | PYPI }
  [ API_INTEGRATION = '<integration_name>' ]
  [ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , ... ] ) ]
  [ COMMENT = '<string_literal>' ]

Required parameters

name

Specifies the identifier for the artifact repository. The identifier must be unique for the schema where the repository is created. For more details, see Identifier requirements.

TYPE = { APPLICATION | PYPI }

Specifies the type of content the repository stores.

  • APPLICATION: stores versioned application packages. Required when the repository is referenced by CREATE APPLICATION SERVICE.
  • PYPI: stores Python packages fetched from an external package index. The API_INTEGRATION parameter is required for this type.

Optional parameters

API_INTEGRATION = 'integration_name'

Specifies the API integration that provides access to the external Python package index. Required when TYPE = PYPI. Not used when TYPE = APPLICATION.

TAG ( tag_name = 'tag_value' [ , ... ] )

Assigns a tag to the repository. For more details about object tagging, see Introduction to object tagging.

COMMENT = 'string_literal'

Specifies a comment for the artifact repository.

DEFAULT: No value

Access control requirements

If your role does not own the objects in the following table, then your role must have the listed privileges on those objects:

PrivilegeObjectNotes
CREATE ARTIFACT REPOSITORYSchemaRequired to create a new artifact repository in the schema.
USAGEAPI integrationRequired only when TYPE = PYPI.

Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema.

For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.

For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Usage notes

  • An APPLICATION repository holds one or more packages. Each package has one or more versions. New versions are produced by builds that target the repository. For more information, see Getting started with Snowflake App Runtime.
  • A repository’s type can’t be changed after it’s created. To switch types, drop the repository and create a new one.
  • CREATE OR REPLACE drops and recreates the repository atomically. All packages and versions in the repository are removed.
  • The OR REPLACE and IF NOT EXISTS clauses are mutually exclusive. They can’t both be used in the same statement.
  • CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.

Examples

Create an artifact repository for application packages:

CREATE ARTIFACT REPOSITORY my_app_repo
  TYPE = APPLICATION
  COMMENT = 'Repository for my team''s apps';

Create a PyPI-backed repository that uses an existing API integration:

CREATE ARTIFACT REPOSITORY my_pypi_repo
  TYPE = PYPI
  API_INTEGRATION = pypi_integration;