snow 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 / --no-interactive
  --force
  --validate / --no-validate
  --package-entity-id <package_entity_id>
  --app-entity-id <app_entity_id>
  --project <project_definition>
  --env <env_overrides>
  --connection <connection>
  --host <host>
  --port <port>
  --account <account>
  --user <user>
  --password <password>
  --authenticator <authenticator>
  --private-key-file <private_key_file>
  --token-file-path <token_file_path>
  --database <database>
  --schema <schema>
  --role <role>
  --warehouse <warehouse>
  --temporary-connection
  --mfa-passcode <mfa_passcode>
  --enable-diag
  --diag-log-path <diag_log_path>
  --diag-allowlist-path <diag_allowlist_path>
  --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 INTEGER

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. Default: False.

--interactive / --no-interactive

When enabled, this option displays prompts even if the standard input and output are not terminal devices. Defaults to True in an interactive shell environment, and False otherwise.

--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. Default: False.

--validate / --no-validate

When enabled, this option triggers validation of a deployed Snowflake Native App’s setup script SQL. Default: True.

--package-entity-id TEXT

The ID of the package entity on which to operate when definition_version is 2 or higher. Default: .

--app-entity-id TEXT

The ID of the application entity on which to operate when definition_version is 2 or higher. Default: .

-p, --project TEXT

Path where Snowflake project resides. Defaults to current working directory.

--env TEXT

String in format of key=value. Overrides variables from env section used for templates. Default: [].

--connection, -c, --environment TEXT

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

--host TEXT

Host address for the connection. Overrides the value specified for the connection.

--port INTEGER

Port for the connection. Overrides the value specified for the connection.

--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-file, --private-key-path TEXT

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

--token-file-path TEXT

Path to file with an OAuth token that should be used when connecting to Snowflake.

--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. Default: False.

--mfa-passcode TEXT

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

--enable-diag

Run python connector diagnostic test. Default: False.

--diag-log-path TEXT

Diagnostic report path. Default: <temporary_directory>.

--diag-allowlist-path TEXT

Diagnostic report path to optional allowlist.

--format [TABLE|JSON]

Specifies the output format. Default: TABLE.

--verbose, -v

Displays log entries for log levels info and higher. Default: False.

--debug

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

--silent

Turns off intermediate output to console. Default: False.

--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 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 Install and test an app locally for more information.

By default, the snow app run command creates an application package in your Snowflake account, uploads code files to its stage, validates the setup script SQL, and then creates (or upgrades) a development-mode instance of that application. You should keep the following 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 artifact 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-directive --force --connection="dev"
    
    Copy
  • This example shows how to pass in multiple environment variables using the --env option:

    snow app run --env source_folder="src/app" --env stage_name=mystage
    
    Copy