Using a Git repository in Snowflake

You can integrate your remote Git repository with Snowflake so that files from the remote repository are synchronized to a local clone of the repository in Snowflake. The Git repository clone in Snowflake acts as a local Git repository with a full clone of the remote repository, including branches, tags, and commits.

After you’ve created the Git repository clone, you can refer in Snowflake code to repository files on the clone in Snowflake. For example, when creating a stored procedure, you can import a file from the Git repository clone and use it as the procedure’s handler.

With a Git repository clone in Snowflake, you can do the following:

  • Fetch files from your remote Git repository to the clone for use in Snowflake applications.

    The files in the Git repository clone represent a full clone of the repository that you can refresh as the remote epository changes.

  • Interact with the Git repository clone, viewing information about branches and tags.

  • Commit and push changes to the remote repository.

    Writing to the remote repository is supported only from the following Snowflake features:

  • From a Git repository clone synchronized from your remote repository, import files into code you execute in Snowflake.

    For example, you can write procedures and user-defined functions (UDFs) whose handler code is held by the Git repository clone synchronized from the repository.

  • In Snowflake, use files from any branch, tag, or commit.

How Snowflake works with a remote Git repository

With a remote Git repository integrated with your Snowflake account, you synchronize files from the remote repository to a Git repository clone in Snowflake. To access a file in Snowflake, you refer to it in the Git repository clone. For more information about using repository files, see Use a Git repository file as a stored procedure handler.

Diagram showing Git repository exchanging files with development tools and Snowflake.

Snowflake Git repository clone

A Git repository clone in Snowflake is a full clone with all branches, tags, and commits from the remote repository.

After remote repository contents are in the Git repository clone, you can reference files there as you would a file on a stage. You can execute GET commands against a Git repository clone.

You can perform operations similar to those you perform with Git commands in a local repository, including:

A Git repository clone in Snowflake includes additional properties specific to the remote repository’s integration with Snowflake. These properties include:

  • The origin URL of the remote Git repository

  • A secret, if needed, that contains credentials for authenticating with the remote repository

  • A Snowflake API integration that specifies how Snowflake should interact with the Git API

For more information, see View Git repository clone properties.

Git repository and development tools

After you integrate your remote repository with Snowflake, you can continue using your development tools and local repository as before. Through the Git repository clone, Snowflake becomes another client of your repository separate from your local repository.

Supported platforms

You can currently integrate Git repositories that use the following Git platforms. This includes repositories based on these platforms, but available at custom URLs. For example, a repository based on GitHub does not need to be at github.com.

  • GitHub

  • GitLab

  • BitBucket

  • Azure DevOps

  • AWS CodeCommit

References