SnowSQL Setup & Connection
Snowflake · Staging & SnowSQL
Theory
SnowSQL is Snowflake's original command-line client for running SQL and file commands from a terminal or script. Snowflake now calls it a legacy client: new features go only into Snowflake CLI (the snow command), which is the recommended client for new work. Both connect with an account identifier of the form orgname-accountname, and both save named connections in a config file, so snowsql -c my_conn or snow sql -c my_conn connects with one short command.
The main reason learners need a client is moving files between their machine and an internal stage: PUT and GET in SnowSQL, or snow stage copy in Snowflake CLI. Existing SnowSQL scripts keep working while their version is supported, but plan new automation on Snowflake CLI.
Why we use it
Some tasks need a client on your machine: uploading local files to a stage, downloading unloaded files, and running SQL scripts from schedulers or CI jobs where there is no browser. Knowing both clients lets you maintain old SnowSQL scripts and write new ones in Snowflake CLI.
When to use it
Use Snowflake CLI for new file uploads, scripted deployments and automation; keep SnowSQL only for existing scripts. Use Snowsight Workspaces for interactive analysis. Use key-pair authentication rather than passwords in scripts.
Snowflake CLI vs SnowSQL
Snowflake CLI (the snow command) is the preferred command-line client and the only one getting new features. SnowSQL is a legacy client that is still supported for existing scripts; check its version's support end date and plan a move to Snowflake CLI.
Connecting to Your Account
Both clients need your account identifier, preferably orgname-accountname. In Snowsight, open the account selector and choose View account details; its Config File tab gives a ready-made connection you can paste.
Saving Connection Details
A config file saves account, user, role, warehouse and database as a named connection so you don't retype them — Snowflake CLI uses config.toml with [connections.<name>] sections. Keep passwords out of it; use key-pair auth or environment variables.
How it works
- Install Snowflake CLI (or SnowSQL for legacy scripts)
- Copy the account identifier from View account details in Snowsight
- Add a named connection (snow connection add)
- Test it with snow connection test -c my_conn
- Did authentication succeed? Yes: Set role, warehouse, database and schema. No: Check identifier, user, network policy or MFA.
- Run SQL and file commands from the terminal
Example
-- Run in a terminal, NOT inside Snowflake.
-- Snowflake CLI (recommended):
-- snow connection add
-- snow connection test -c my_conn
-- snow sql -c my_conn -q "SELECT CURRENT_ACCOUNT();"
-- SnowSQL (legacy):
-- snowsql -a myorg-myaccount -u AYUSHIKey points
- Snowflake CLI (snow) is the recommended client; SnowSQL is legacy
- Account identifiers use the orgname-accountname form
- Config files store named connection profiles for reuse
- Both run the same SQL as Snowsight, plus file transfer to internal stages
- Prefer key-pair authentication over passwords in scripts
- Never commit a config file that contains passwords