Snowflake Connector
Run SQL queries on Snowflake and save results to your data store.
Why use this connector?
Query directly from Valohai: No need to export data manually. Write SQL, run execution, get CSV output.
Version your queries: Every query is saved with the execution. Reproduce results months later by checking which query ran when.
Feed downstream jobs: Query outputs get datum URLs. Use them as inputs in other executions or pipelines.
Requirements
Organization and account in Snowflake
Existing database with data
Firewall settings allow Valohai workers to access the database
User with permissions to query the database
Authentication
Snowflake uses username and password authentication.
Set these environment variables:
SNOWSQL_ACCOUNT: Your Snowflake account in format<orgname>-<account_name>SNOWSQL_WAREHOUSE: Warehouse nameSNOWSQL_DATABASE: Database nameSNOWSQL_SCHEMA: (Optional) Schema name, default isPUBLICSNOWSQL_USER: Snowflake usernameSNOWSQL_PWD: Snowflake password (mark as a secret)
Add environment variables
Environment variables can be added:
Project-wide: Project Settings → Environment Variables
Organization-wide: Admin users can create environment variable groups that can be passed to several projects.
Per-execution: Set when creating the execution
We recommend project or organization settings for credentials.
Run a query
Open your project
Click Create Execution
Expand valohai-ecosystem → Select
snowflake-queryConfigure parameters:
query: Your SQL query
output-path: (Optional) Output filename, default is
results.csvdatum-alias: (Optional) Alias for easy reference, e.g.,
latest-sales
Verify environment variables are set
Click Create Execution
Example query
SELECT
region,
product_line,
SUM(revenue) as total_revenue,
AVG(profit_margin) as avg_margin
FROM sales_data
WHERE sale_date >= '2025-01-01'
GROUP BY region, product_line
ORDER BY total_revenue DESC
LIMIT 500Results are saved as results.csv (or your custom output path) and uploaded to your data store.
Use query results
The output gets a datum URL. Reference it in other executions:
- step:
name: analyze-sales
image: python:3.11
command:
- python analyze.py
inputs:
- name: sales-data
default: datum://latest-salesOr use it in a pipeline by passing the execution output to the next node.
Troubleshooting
Connection fails
Check:
SNOWSQL_ACCOUNTformat is correct:<orgname>-<account_name>Firewall rules allow Valohai workers to connect
Warehouse is running (not suspended)
Authentication fails
Check:
SNOWSQL_USERandSNOWSQL_PWDare correctUser has access to the specified database and warehouse
Password is marked as a secret in Valohai
Query fails with permission error
Check:
User has
SELECTpermission on the tablesSchema name is correct (default is
PUBLIC)Database and warehouse names match your Snowflake setup
Next steps
Other database connectors:
Build your own:
Last updated
Was this helpful?
