{"id":5485,"library":"snowflake-cli","title":"Snowflake CLI","description":"Snowflake CLI is an open-source command-line interface designed for developers building applications and managing workloads on Snowflake. It supports tasks across Streamlit in Snowflake, the Snowflake Native App Framework, Snowpark Container Services, and general SQL operations. The library maintains an active development pace with frequent, often monthly or bi-monthly, releases and major version updates introducing significant behavior changes.","status":"active","version":"3.16.0","language":"en","source_language":"en","source_url":"https://github.com/snowflakedb/snowflake-cli","tags":["snowflake","cli","data warehousing","cloud","devops","sql","snowpark","streamlit","native app"],"install":[{"cmd":"pip install snowflake-cli","lang":"bash","label":"Install via pip (Python environments). Other OS-specific installers are also available."}],"dependencies":[{"reason":"Core dependency for connecting to Snowflake; frequently updated with CLI releases.","package":"snowflake-connector-python"}],"imports":[],"quickstart":{"code":"# 1. Install Snowflake CLI (if not already installed)\n# pip install snowflake-cli\n\n# 2. Add a new connection interactively\n# This command will prompt you for connection details like account, user, warehouse, etc.\n# For non-interactive use, consider environment variables (SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, SNOWFLAKE_PASSWORD) or a pre-configured config.toml file.\nprint('Run \"snow connection add\" and follow the prompts to set up a connection.')\nprint('Example prompts: \\n  Connection name: my_snowflake_conn\\n  Account: <your_account_identifier>\\n  User: <your_username>\\n  Password: <your_password>')\n\n# Simulate environment variables for a non-interactive quickstart (replace with actual values)\nimport os\nos.environ['SNOWFLAKE_ACCOUNT'] = os.environ.get('SNOWFLAKE_ACCOUNT', 'your_account_identifier')\nos.environ['SNOWFLAKE_USER'] = os.environ.get('SNOWFLAKE_USER', 'your_username')\nos.environ['SNOWFLAKE_PASSWORD'] = os.environ.get('SNOWFLAKE_PASSWORD', 'your_password')\n\n# 3. Execute a simple SQL query using the configured connection\n# Assuming a default connection 'my_snowflake_conn' has been set up\nprint('\\nExecuting a simple SQL query:')\n# Use --connection to explicitly specify the connection name\n# For simplicity, if one connection is default, it might not be needed.\n# In a real script, consider using `snow connection set-default my_snowflake_conn` first, or pass --connection.\nimport subprocess\nresult = subprocess.run(['snow', 'sql', '--query', 'SELECT CURRENT_VERSION()', '--connection', 'my_snowflake_conn'], capture_output=True, text=True)\nprint(result.stdout)\nif result.stderr:\n    print(f\"Error: {result.stderr}\")\n\n# 4. Initialize a new Streamlit in Snowflake project\n# print('\\nInitializing a Streamlit project:')\n# subprocess.run(['snow', 'init', '--template', 'streamlit-python', 'my_streamlit_app_project'], check=True)\n# print('Streamlit project \"my_streamlit_app_project\" created.')\n","lang":"python","description":"This quickstart demonstrates how to install Snowflake CLI, configure a new connection, and execute a basic SQL query. It also shows how to initialize a project from a template. For authentication, it relies on environment variables or an interactively configured `config.toml` file."},"warnings":[{"fix":"Upgrade your Python environment to version 3.10 or higher.","message":"Snowflake CLI dropped support for Python versions below 3.10 starting with version 3.0.0. Ensure your Python environment is 3.10 or newer.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Update existing scripts and workflows to use the new command syntax. Refer to the official release notes for a complete list of changes.","message":"Several commands were renamed or consolidated in version 3.0.0. For instance, 'snow object stage' commands were replaced by 'snow stage' commands, and 'snow snowpark init'/'snow streamlit init' were replaced by 'snow init'.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Transition from SnowSQL to Snowflake CLI. The `snow helpers import-snowsql-connections` command can assist in migrating existing SnowSQL connection configurations.","message":"Snowflake CLI is the recommended modern command-line tool, replacing the legacy SnowSQL client. While SnowSQL is still available, new features and enhancements are exclusively added to Snowflake CLI.","severity":"deprecated","affected_versions":"All (transition recommended)"},{"fix":"Set the correct file permissions using `chown $USER config.toml` and `chmod 0600 config.toml`.","message":"On MacOS and Linux systems, the `config.toml` file (default location: `~/.config/snowflake/config.toml` or `~/.snowflake/config.toml`) requires specific file permissions (read and write for the file owner only) for security. Incorrect permissions can lead to connection issues.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}