LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

snowsql

Snowflake cloud data warehouse CLI client

TLDR

Connect to Snowflake
$ snowsql -a [account] -u [username]
copy
Execute query
$ snowsql -a [account] -u [user] -q "[SELECT * FROM table]"
copy
Run SQL file
$ snowsql -a [account] -u [user] -f [script.sql]
copy
Specify database
$ snowsql -a [account] -u [user] -d [database]
copy
Specify warehouse
$ snowsql -a [account] -u [user] -w [warehouse]
copy
Specify role
$ snowsql -a [account] -u [user] -r [role]
copy
Output in CSV format
$ snowsql -a [account] -u [user] -o output_format=[csv]
copy
Use a named connection from config
$ snowsql -c [connection_name]
copy

SYNOPSIS

snowsql [-a account] [-u user] [-d database] [options]

DESCRIPTION

snowsql is the official command-line client for Snowflake, a cloud-based data warehouse platform. It provides an interactive SQL shell for querying, managing databases, and performing administrative tasks on Snowflake accounts.Connections require a Snowflake account name and credentials, which can be provided on the command line, entered interactively, or stored in a configuration file. The client supports specifying database, schema, warehouse, and role context at connection time.SQL queries can be executed interactively in the shell, passed directly via -q, or run from script files with -f for batch automation. Output can be formatted as tables, CSV, TSV, or other formats using the -o output_format option, making it useful for data export and pipeline integration.

PARAMETERS

-a, --accountname ACCOUNT

Snowflake account.
-u, --username USER
Username.
-d, --dbname DB
Database.
-w, --warehouse WH
Warehouse.
-s, --schemaname SCHEMA
Schema.
-q, --query SQL
Execute query.
-f, --filename FILE
Run SQL file.
-r, --rolename ROLE
Default role to use.
-c, --connection NAME
Use a named connection from config file.
-D, --variable KEY=VALUE
Define a variable (referenced as &KEY in queries).
-o OPTION=VALUE
Set option (e.g., output_format=csv, quiet=true, friendly=false).
--version
Display SnowSQL version.
--upgrade
Force upgrade to latest SnowSQL version.
--config FILE
Path to configuration file.

CONFIGURATION

~/.snowsql/config

Connection profiles, default settings, and stored credentials for SnowSQL sessions.
SNOWSQL_ACCOUNT
Environment variable specifying the default Snowflake account name.
SNOWSQL_PWD
Environment variable specifying the default password.
SNOWSQL_ROLE
Environment variable specifying the default role.

INSTALL

nix profile install nixpkgs#snowsql
copy

CAVEATS

Requires Snowflake account. Large results may be slow. MFA may be required.

HISTORY

SnowSQL is the official CLI for Snowflake cloud data warehouse. It provides terminal-based access to Snowflake's SQL engine.

SEE ALSO

psql(1), mysql(1), bq(1)

Copied to clipboard
Kai