Announcing Snowflake CLI PuPr โ€” Unleashing the Power of our Command-Line Interface! ๐Ÿš€

Snowflake is thrilled to announce the official Public Preview of the Snowflake CLI! This open-source command-line interface empowers developers with support for Snowflake Native Apps, Streamlit, Snowpark, Snowpark Container Services(SPCS) , and SQL operations, making it ideal for diverse developer-centric workloads on Snowflake.

The Snowflake CLI is a cornerstone developer tool, boosting productivity and enabling CI/CD automation for smoother DevOps workflows. This Public Preview release (PuPr) represents a significant upgrade. Weโ€™ve completely redesigned the commands, simplifying them to hide complex SQL behind user-friendly options. New commands streamline building, deploying, and running NativeApps, Snowpark, Streamlit, and SPCS workloads. Additionally, enhanced connection and logging capabilities further improve usability.

Valuable feedback from our private preview highlighted a strong demand for expanded CLI commands to deploy, build, and manage workloads. Responding to this need, weโ€™ve significantly enhanced support for DevOps, empowering customers to streamline CI/CD automation, DevOps workflows, and ultimately accelerate release velocity.

Features

  • Redesigned unified command design across CLI
  • Snowpark : Easily build, package and deploy Snowpark apps
  • SPCS : Manage Compute pools, Services, registry, and check logs
  • NativeApp: Simple commands to create apps using pre-defined templates, build and run Native Apps
  • Streamlit : Create, deploy, share, or manage Streamlit apps
  • SQL: Execute SQL queries, ad-hoc queries or files containing SQL queries
  • Objects: Manage Snowflake objects like Stage,Tables , Schema, etc as first-class CLI commands
  • Snowflake Projects : Manage & define multiple Snowapark, Streamlit , NativeApp apps using Snowflake project file with CLI.
  • Unified Connection : Manage , test , add multiple connections for different envs via CLI
  • Enhanced Telemetry/Logging

What does Snowflake CLI do?

Snowflake CLI can be installed on Linux, Windows, or Mac. To install it, run the following command in a terminal:

pip install snowflake-cli-labs

Once itโ€™s been successfully installed, run the following command to verify that it was successfully installed:

snow --help

Snowpark

With Snowflake CLI you can automate deployment of multiple Snowpark procedures and functions. To test it out create an example project, built it, and deploy it by running:

snow snowpark init my_snowpark_example
cd my_snowpark_example
snow snowpark build
snow snowpark deploy

Snowpark Container Services

Snowflake CLI helps with managing Snowpark Container Services. It allows you to easily login into image registry by running

snow spec image-registry login

Native App

Initialize a Snowflake Native App project using the CLI

snow app init na_streamlit_project --template streamlit-python

Build the Native app

snow app run

Opening a Snowflake Native App from the command line

snow app open

Stages

You can use the CLI to upload and download objects from Snowflake stages:

snow object stage copy @my_stage local_dir/
snow object stage copy local_dir/ @my_stage

Snowflake Object Management

Snowflake CLI provides generic describe, show, and drop operation commands:

snow object list table
snow object describe table MY_TABLE
snow object drop table MY_TABLE

SQL

To execute SQL queries using Snowflake CLI, you can use the snow sql command.

The snow sql command can be run as follows:

snow sql -h
Usage: snow sql [OPTIONS]
Executes Snowflake query.
Query to execute can be specified using query option, filename
option (all queries from file will be executed) or via stdin by
piping output from other command. For example `cat my.sql | snow sql
-i`.
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ - query -q TEXT Query to execute. [default: None] โ”‚
โ”‚ - filename -f FILE File to execute. [default: None] โ”‚
โ”‚ - stdin -i Read the query from standard input. Use โ”‚
โ”‚ it when piping input to this command. โ”‚
โ”‚ - help -h Show this message and exit. โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Executing ad-hoc query

To execute an ad-hoc query run the following command:

snow sql --query "select 1 as a, 2 as b, 3 as c"
This command will output the following:
+ - - - - - -+
| A | B | C |
| - -+ - -+ - -|
| 1 | 2 | 3 |
+ - - - - - -+
You can execute multiple queries using - query parameter. For example:
snow sql - query "select 42 as a; select 2 as b"

Check out CLI quickstart for more details on the commands.

Whatโ€™s Next

As we actively gather feedback from our PuPr customers, our focus sharpens on key areas as we move toward the General Availability (GA) phase. Hereโ€™s the GA roadmap:

  • DevOps command integrating SnowGIt and Execute Immediate
  • Improved Packaging support in Snowpark
  • Github Action for CLI
  • Notebooks support for CLI for DevOps
  • SPCS/Snowpark templates support
  • CLI Plugin for 3rd party developers
  • SnowSQL full parity
  • Cortex Search/LLM Integration

Get started today!

Install: Simply run pip install snowflake-cli-labs ;)

Explore our resources:

Your feedback matters! Share suggestions and feature requests at developers@snowflake.com.

Happy command-lining!

--

--