Connect with Snowflake command-line tool
Learn how to connect Snowflake command-line tool to Embucket. Run SQL queries with familiar Snowflake commands. Leverage your existing Snowflake workflows while accessing Embucket’s data processing capabilities.
This guide covers snowflake-cli
configuration to connect to a local Embucket instance and execute SQL queries through the Snowflake-compatible API. This guide covers local development setup only. Production deployments, advanced authentication, and performance optimization remain outside this scope.
- Set up Snowflake command-line tool for local development
- Configure connection parameters specific to Embucket’s API
- Test connectivity with sample data operations
Prerequisites: you need Python 3.8+, Docker, and a running Embucket container.
Install Snowflake command-line tool
Section titled “Install Snowflake command-line tool”Install snowflake-cli
through Python’s package manager:
pip install snowflake-cli
Configure your connection
Section titled “Configure your connection”-
Create a connection profile
Add a connection profile—a saved set of connection parameters—for your Embucket instance:
Terminal window snow connection add --connection-name embucket --account local-dev.embucket --user embucket --password embucket --host localhost --port 3000 --region us-east-1 -
Locate your configuration file
Find your Snowflake command-line tool configuration file:
Terminal window snow --info/Users/[USERNAME]/Library/Application Support/snowflake/config.toml
~/.config/snowflake/config.toml
C:\Users\[USERNAME]\AppData\Roaming\snowflake\config.toml
-
Update the configuration
Edit your configuration file. Add the HTTP protocol setting under
[connections.embucket]
:[connections.embucket]host = "localhost"region = "us-east-1"port = 3000protocol = "http"database = "embucket"schema = "public"warehouse = "compute-wh"password = "embucket"account = "local-dev.embucket"user = "embucket"
Start Embucket
Section titled “Start Embucket”Launch the Embucket container:
docker run --name embucket --rm -p 8080:8080 -p 3000:3000 embucket/embucket
Connect and query
Section titled “Connect and query”-
Open the SQL shell
Connect to Embucket with your configured profile:
Terminal window snow sql -c embucketThe
snowflake-cli
shows its interactive shell prompt. -
Create sample data
Test your connection. Create a table and insert sample data:
CREATE TABLE employees (id INT,name STRING,department STRING,salary DECIMAL(10,2));INSERT INTO employees VALUES(1, 'Alice Johnson', 'Engineering', 95000.00),(2, 'Bob Smith', 'Marketing', 75000.00),(3, 'Carol Davis', 'Engineering', 98000.00); -
Query your data
Run a query to verify the connection works:
SELECT * FROM employees;Expected output:
+---------------------------------------------+| id | name | department | salary ||----+---------------+-------------+----------|| 1 | Alice Johnson | Engineering | 95000.00 || 2 | Bob Smith | Marketing | 75000.00 || 3 | Carol Davis | Engineering | 98000.00 |+---------------------------------------------+
Troubleshooting
Section titled “Troubleshooting”- Connection refused or timeout errors: Verify Embucket container runs on ports 3000 and 8080
- Protocol errors: Check that you set
protocol = "http"
in your configuration file - Authentication failures: Use exactly
embucket
for both username and password - SQL execution errors: Check that you use Snowflake-compatible SQL syntax
Next steps
Section titled “Next steps”Execute advanced workflows with snowflake-cli
and Embucket:
- Execute complex analytical queries with familiar Snowflake SQL dialect syntax
- Manage databases and schemas through
snowflake-cli
commands - Integrate Embucket into existing Snowflake-based workflows
- Test Snowflake queries locally before production deployment