Snowflake CLI
The `snowflake-cli-labs` package provides the official Snowflake Command Line Interface (CLI), a powerful tool for interacting with Snowflake accounts, managing objects, and deploying applications like Snowpark Container Services or Streamlit apps. It's developed by Snowflake-Labs, with version 3.16.0 currently active. Releases typically align with Snowflake platform updates and feature developments.
Common errors
-
Command 'snow' not found
cause The `snowflake-cli-labs` package is not installed, or the `snow` executable is not in your system's PATH.fixRun `pip install snowflake-cli-labs` to install. If already installed, ensure your Python environment's script directory is in your system's PATH. -
Error: Invalid connection profile: <profile_name>
cause The specified connection profile does not exist or has not been configured using `snow connection add`.fixRun `snow connection add --name <profile_name>` to create and configure the connection profile. Use `snow connection list` to see existing profiles. -
ModuleNotFoundError: No module named 'snowflake_cli_labs'
cause You are attempting to import the package using its PyPI name `snowflake_cli_labs`, but its internal Python module name is `snowcli`.fixIf you need to programmatically access CLI components (which is rare for general use), use `import snowcli` or `from snowcli.<submodule> import <symbol>`. -
Failed to create connection: Failed to connect to DB: Authentication failed
cause The credentials provided for the connection profile are incorrect, expired, or the authentication method is misconfigured (e.g., incorrect key file path, browser pop-up blocked).fixVerify your username, password/key, and account locator. For browser-based auth, ensure no pop-up blockers are interfering. For key-pair, double-check the path to your private key. Try `snow connection add --name <profile_name>` again or consult the Snowflake documentation for your specific authentication method.
Warnings
- breaking The `snowflake-cli-labs` package is the official successor to the older, standalone `snowcli` (pre-v1.0). Users of the legacy `snowcli` must migrate, as commands, configurations, and functionalities may differ significantly.
- gotcha Connection authentication methods and profile management can be a common source of issues. The CLI supports browser-based, username/password, and key-pair authentication, each with specific setup requirements.
- breaking The schema for `project.toml` files, used for deploying Snowpark applications, Streamlit apps, or other Snowflake objects, can change between major CLI versions. This may require manual updates to your project definitions.
Install
-
pip install snowflake-cli-labs
Imports
- app
from snowflake_cli_labs import app
from snowcli.cli_app import app
Quickstart
# 1. Verify installation and see available commands snow --help # 2. Add a new connection profile (replace with your details) # This will prompt for your Snowflake account URL, username, and password. # The 'default' profile is used if no other is specified. snow connection add --name default # 3. List existing connection profiles snow connection list # 4. Run a simple SQL query snow sql -q "SELECT current_version();"