SnowSQL, Snowflake CLI and connection choices
A client connects to Snowflake and submits work using its configured identity.
Understand the idea
A command-line client can read a local script, submit statements and display results. The client still connects to a Snowflake account using a user, authentication mechanism and execution context. A terminal command can therefore use a different account or role from your browser session.
| Concept | What it means |
|---|---|
| SnowSQL | Older SQL command-line client found in existing scripts. |
| Snowflake CLI | The snow command supports SQL and developer workflows. |
| Drivers/connectors | Libraries that let Java, BI tools, Python or other callers communicate with Snowflake. |
| Connection context | Account, authentication, role, warehouse and namespace. |
A concrete example
Configure a learning connection, then use snow sql -c learning -q "SELECT CURRENT_ROLE();" to inspect its role.
Remember: Successful login still leaves object permissions and namespace to check.
Explain it step by step · full theory
A command-line client gives SQL a terminal interface
SnowSQL is the older SQL command-line client commonly found in existing scripts. Snowflake CLI uses the snow command and supports SQL plus broader developer workflows. Current documentation directs new CLI feature development toward Snowflake CLI.
A command-line client can read a local script, submit statements and display results. The client still connects to a Snowflake account using a user, authentication mechanism and execution context. A terminal command can therefore use a different account or role from your browser session.
Configure one named connection
For optional local practice, install Snowflake CLI using the official instructions for your operating system, then check snow --version. Use snow connection add to configure a named learning connection. Supply the account identifier and user, then the permitted role, warehouse and namespace as needed.
Choose authentication supported by your account and installed client. Human browser-based sign-in depends on the configured identity flow. Unattended automation needs a supported service authentication method. Keep authentication material out of source-controlled examples.
Use snow connection test -c learning, then submit the context query below. A successful connection test confirms that connection step. A subsequent table query additionally needs object access and the right namespace.
Choose the interface that fits the caller
JDBC connects Java applications through a Java database driver. ODBC connects compatible desktop and reporting tools through an ODBC driver manager. The Python connector provides Python database operations. The SQL API accepts authenticated HTTPS statement requests.
An application’s supported interface determines which driver you install. Before debugging SQL, check client version, account/server format and authentication support. A shared query may work in several clients, while the surrounding configuration is client-specific.
Words used in this lesson
- Driver
- Client software that implements a database connection interface.
- Named connection
- A reusable client-side connection configuration.
- Authentication
- Establishing the identity of a connecting user or service.
See how it works
Choose a step to explore the idea at your own pace.
Open the interactive explanation
SnowSQL, Snowflake CLI and connection choices
Select
Choose the interface supported by the application.
Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.
Read the complete diagram explanation
- Select
Choose the interface supported by the application.
- Configure
Supply connection identity and approved authentication.
- Verify
Inspect the actual session before accessing a table.
Try the SQL or command
Read → predict → run in your learning environment → compare. You can also learn by reading without an account.
New to SQL? Where to run it and how to read it
A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.
- No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
- For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
- Read the entire example, including comments beginning with
--. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor. - Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
- SELECT / FROM
- Choose the values to return / identify their input.
- VALUES / COLUMN1
- VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
- AS / WITH
- AS gives a result a readable name. WITH names a temporary query step within one statement.
- NULL / ::
- NULL means missing or unknown. The :: notation converts a value to a named data type.
- Session
- One connection and its settings. Keep related transaction steps in the same session.
- Database.schema.table
- A full address for stored data. It is separate from the warehouse that processes queries.
Help with common practice errors
- No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
- Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
- Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
- Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.
Before running this lesson
Connection setup depends on the installed client version, operating system and enabled authentication method.
Optional terminal workflow
snow --version
snow connection add
# Name the connection learning during configuration.
snow connection test -c learning
snow sql -c learning -q "SELECT CURRENT_ACCOUNT_NAME(), CURRENT_ROLE();"What to expect and why
These are terminal commands for an installed CLI. Configure the learning connection with your own account and supported authentication. Compare the returned account and role with your setup notes.
Check your understanding
Choose an answer, then check your reasoning. This is practice, not a scored test.
Try it yourself
Describe the checks needed when CLI connects but a table query fails.
Compare your reasoning
Inspect the current role and namespace, the fully qualified table name and required privileges. Compare those values with the browser session that can read the table.
Official sources and curriculum
Module 01 · See module scope