app run

Creates an application package in your Snowflake account, uploads code files to its stage, then creates or upgrades an application object from the application package.

Syntax

snow app run
  --version <version>
  --patch <patch>
  --from-release-directive
  --interactive
  --force
  --project <project_definition>
  --connection <connection>
  --account <account>
  --user <user>
  --password <password>
  --authenticator <authenticator>
  --private-key-path <private_key_path>
  --database <database>
  --schema <schema>
  --role <role>
  --warehouse <warehouse>
  --temporary-connection
  --mfa-passcode <mfa_passcode>
  --format <format>
  --verbose
  --debug
  --silent
Copy

Arguments

None

Options

--version TEXT

The version defined in an existing application package from which you want to create an application object. The application object and application package names are determined from the project definition file.

--patch TEXT

The patch number under the given --version defined in an existing application package that should be used to create an application object. The application object and application package names are determined from the project definition file.

--from-release-directive

Creates or upgrades an application object to the version and patch specified by the release directive applicable to your Snowflake account. The command fails if no release directive exists for your Snowflake account for a given application package, which is determined from the project definition file. Default: unset.

--interactive, -i

When enabled, this option displays prompts even if the standard input and output are not terminal devices. Defaults to unset.

--force

When enabled, this option causes the command to implicitly approve any prompts that arise. You should enable this option if interactive mode is not specified and if you want perform potentially destructive actions. Defaults to unset.

-p, --project TEXT

Path where the Snowflake Native App project resides. Defaults to current working directory.

--connection, -c, --environment TEXT

Name of the connection, as defined in your config.toml. Default: default.

--account, --accountname TEXT

Name assigned to your Snowflake account. Overrides the value specified for the connection.

--user, --username TEXT

Username to connect to Snowflake. Overrides the value specified for the connection.

--password TEXT

Snowflake password. Overrides the value specified for the connection.

--authenticator TEXT

Snowflake authenticator. Overrides the value specified for the connection.

--private-key-path TEXT

Snowflake private key path. Overrides the value specified for the connection.

--database, --dbname TEXT

Database to use. Overrides the value specified for the connection.

--schema, --schemaname TEXT

Database schema to use. Overrides the value specified for the connection.

--role, --rolename TEXT

Role to use. Overrides the value specified for the connection.

--warehouse TEXT

Warehouse to use. Overrides the value specified for the connection.

--temporary-connection, -x

Uses connection defined with command line parameters, instead of one defined in config.

--mfa-passcode TEXT

Token to use for multi-factor authentication (MFA).

--format [TABLE|JSON]

Specifies the output format.

--verbose, -v

Displays log entries for log levels info and higher.

--debug

Displays log entries for log levels debug and higher; debug logs contains additional information.

--silent

Turns off intermediate output to console.

--help

Displays the help text for this command.

Usage notes

Note

This command does not accept a role or warehouse overrides to your config.toml file. Please add them to the native app definition in the snowflake.yml or snowflake.local.yml instead.

This command relies on the resolved project definition to determine the stage to which to upload files, which files to upload, and the name of the objects to create. For guidance on defaults, please refer to About Snowflake Native App projects and snow app init usage notes. You can also change them to be according to your own preference, though it is your responsibility to check if there is any clash with existing objects in your account.

  • Objects created by Snowflake CLI are tagged with a special comment GENERATED_BY_SNOWCLI.

  • The role(s) used to create the application package and instance must have the proper account-level privileges to work with Snowflake Native Applications. See Create an application package and Create an application object for more information.

By default, the snow app run command creates an application package in your Snowflake account, uploads code files to its stage, then creates (or upgrades) a development-mode instance of that application. There are a few things to keep in mind when running the default command.

  • All files specified under nativeapp.project.artifacts in the project definition file(s) are uploaded to the Snowflake stage. This must include a manifest.yml file, and its related setup script(s).

  • All files specified under nativeapp.project.artifacts must have already been compiled and packaged separately, if needed, before calling snow app run. Snowflake CLI does not offer any feature to perform these intermediate tasks for you, so you have full control over your build process by executing it in your own scripts.

  • Snowflake CLI uses default application package name, stage name, and application name when creating those objects.

  • Subsequent runs of snow app run after the initial one compare the state of your uploaded files to the files in your local directory, and selectively upload only the modified files to save you time. If any files have changed, the application is upgraded based on the new contents of the stage.

  • If the application package already exists and its distribution property is INTERNAL, the command checks if the package was created by the Snowflake CLI. If it was not, the command throws an error. If the distribution of the application package is EXTERNAL, no such check is performed.

  • The command warns you if the application package you are working with has a different value for distribution than is set in your resolved project definition, but continues execution.

  • The application instance is created or upgraded in development mode. Specifically, it uses the staged files.

If you specify a --version, --patch or --from-release-directive option, this command upgrades your existing application instance, or creates one if the application does not exist. It does not create an application package in this scenario.

  • If Snowflake CLI is not able to update your application for any reason, such as trying to upgrade an application initially installed in loose files mode to use release directives instead, it attempts to drop the existing application and create a new one using the desired installation strategy. The command prompts you to confirm the drop before performing the action.

  • If you do not want to interact with the command and instead force all actions, use the --force option to bypass all prompts, which proxies as a yes to all the inputs asking whether to proceed with destructive actions.

  • Snowflake CLI tries to determine if you are running the commands in an interactive shell. If --force is not provided and you are executing commands in the interactive shell, it automatically chooses the interactive option for you.

  • If you want to force Snowflake CLI to interact with you even if not in an interactive shell, use the --interactive option.

Examples

These examples assume you have made the necessary changes to your code files and added them to your snowflake.yml or snowflake.local.yml files.

If you want to create an application package and an application using staged files, you can execute:

cd my_app_project
my_app_project_build_script.sh
snow app run --connection="dev"
Copy

If you already have an application package with a version and a patch, want to create an application from this version and patch, and invoke the interactive mode, you can execute:

snow app run --version V1 --patch 12 --interactive --connection="dev"
Copy

Here, version V1 and patch 12 are used as an example only.

If you have an existing release directive set on an application package, want to create an application from it and bypass the interactive mode, you can execute:

snow app run --from-release-directives --force --connection="dev"
Copy