A Snowflake emulator written in Rust for local development and testing. Built on DataFusion, compatible with Snowflake SQL API v2.
docker run -p 8080:8080 ghcr.io/sivchari/snowflake-emulator:latestcargo build --release --package server
./target/release/serverThe server starts on localhost:8080.
Use any Snowflake-compatible driver. Example with Go:
import "github.com/snowflakedb/gosnowflake"
cfg := &gosnowflake.Config{
Account: "emulator",
User: "user",
Password: "password",
Host: "localhost",
Port: 8080,
Protocol: "http",
}
dsn, _ := gosnowflake.DSN(cfg)
db, _ := sql.Open("snowflake", dsn)| Type | Description |
|---|---|
| VARIANT | JSON-compatible dynamic type |
| ARRAY | JSON array |
| OBJECT | JSON object |
| Standard types | INT, DOUBLE, VARCHAR, BOOLEAN, DATE, TIMESTAMP |
- LATERAL FLATTEN - Expand arrays/objects into rows
- QUALIFY - Filter window function results
- PIVOT / UNPIVOT - Transform rows to columns and vice versa
- MERGE INTO - Upsert operations
- COPY INTO - Load data from stages
| Category | Examples |
|---|---|
| JSON | PARSE_JSON, GET, GET_PATH, OBJECT_KEYS |
| Array | ARRAY_CONSTRUCT, ARRAY_AGG, ARRAY_FLATTEN |
| Object | OBJECT_CONSTRUCT, OBJECT_INSERT, OBJECT_DELETE |
| Window | ROW_NUMBER, LAG, LEAD, CONDITIONAL_TRUE_EVENT |
| String | SPLIT, REGEXP_LIKE, REGEXP_REPLACE |
| Date | DATEADD, DATEDIFF, TO_TIMESTAMP |
| Conditional | IFF, NVL, NVL2, DECODE |
CREATE/DROP DATABASE,CREATE/DROP SCHEMACREATE/DROP TABLE,CREATE/DROP VIEWINSERT,UPDATE,DELETE,TRUNCATEBEGIN,COMMIT,ROLLBACK(transactions)SHOW TABLES,DESCRIBE,INFORMATION_SCHEMA
name: Test with Snowflake Emulator
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
snowflake:
image: ghcr.io/sivchari/snowflake-emulator:latest
ports:
- 8080:8080
steps:
- uses: actions/checkout@v4
- name: Run tests
run: go test ./...
env:
SNOWFLAKE_HOST: localhost
SNOWFLAKE_PORT: 8080
SNOWFLAKE_PROTOCOL: httpservices:
snowflake:
image: ghcr.io/sivchari/snowflake-emulator:latest
ports:
- "8080:8080"
app:
build: .
depends_on:
- snowflake
environment:
SNOWFLAKE_HOST: snowflake
SNOWFLAKE_PORT: 8080container, _ := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: testcontainers.ContainerRequest{
Image: "ghcr.io/sivchari/snowflake-emulator:latest",
ExposedPorts: []string{"8080/tcp"},
WaitingFor: wait.ForHTTP("/health").WithPort("8080"),
},
Started: true,
})This emulator is designed for testing, not production use:
- No distributed execution (single-node only)
- No access control (GRANT/REVOKE are no-ops)
- No warehouse management
- Transaction isolation is not guaranteed
MIT