LinuxCommandLibrary

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
Output format
$ snowsql -a [account] -u [user] -o output_format=[csv]
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.
-o OPTION=VALUE
Set option.

CONFIGURATION

~/.snowsql/config

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

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)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community