SnowDuck

Run Snowflake SQL locally, powered by DuckDB β€” lightweight in-memory SQL engine for development and testing.

Get Started View on GitHub


Why SnowDuck?

SnowDuck is a drop-in Snowflake mock that lets you run Snowflake SQL locally without a cloud connection. Perfect for:

  • πŸ§ͺ Unit Testing β€” Test your Snowflake queries without cloud costs
  • πŸš€ Local Development β€” Iterate faster with sub-millisecond query times
  • πŸ”„ CI/CD Pipelines β€” Run dbt tests without Snowflake credentials
  • πŸ“š Learning β€” Experiment with Snowflake SQL syntax offline

Features

Feature Status
100+ Snowflake Functions βœ… String, Date, Numeric, JSON, Array, Aggregate
SQL Transpilation βœ… Automatic Snowflake β†’ DuckDB translation
Session Variables βœ… SET/UNSET with context persistence
Session Parameters βœ… ALTER SESSION SET/UNSET, read back with SHOW PARAMETERS
Identifier Case βœ… Unquoted names fold to upper case, as in Snowflake
LATERAL FLATTEN βœ… Full support via UNNEST
QUALIFY Clause βœ… Native DuckDB support
SHOW Commands βœ… Snowflake’s column shapes, with TERSE / LIKE / STARTS WITH / LIMIT … FROM
Information Schema βœ… Per-database Snowflake-shaped INFORMATION_SCHEMA views
Snowpipe Streaming API βœ… Full REST API mock
SQL REST API βœ… /api/v2/statements endpoints
dbt Compatibility βœ… Verified end to end against dbt-core 1.12 / dbt-snowflake 1.12

Getting Started

Installation

pip install snowduck

For the REST API server:

pip install snowduck[server]

Quick Start

import snowflake.connector
from snowduck import start_patch_snowflake, stop_patch_snowflake

# Start the mock
start_patch_snowflake()

# Use Snowflake connector as normal - it's now mocked!
conn = snowflake.connector.connect(
    user="test",
    password="test", 
    account="test"
)

cursor = conn.cursor()
cursor.execute("SELECT 'Hello, SnowDuck!' AS greeting")
print(cursor.fetchone()[0])  # Hello, SnowDuck!

# Clean up
stop_patch_snowflake()

With pytest

import pytest
from snowduck import mock_snowflake

@mock_snowflake
def test_my_query():
    import snowflake.connector
    conn = snowflake.connector.connect(user="x", password="x", account="x")
    cursor = conn.cursor()
    cursor.execute("SELECT UPPER('hello') AS result")
    assert cursor.fetchone()[0] == "HELLO"

Docker

Run the SnowDuck server as a container:

docker run -p 8000:8000 ghcr.io/hupe1980/snowduck:latest

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Your Application                        β”‚
β”‚              (snowflake-connector-python)                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚ Patched
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      SnowDuck                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Connector  β”‚  β”‚   Dialect   β”‚  β”‚    Info Schema      β”‚  β”‚
β”‚  β”‚   Layer     β”‚  β”‚   Layer     β”‚  β”‚      Manager        β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚         β”‚                β”‚                     β”‚             β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚                          β”‚                                   β”‚
β”‚                  β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”                           β”‚
β”‚                  β”‚    DuckDB     β”‚                           β”‚
β”‚                  β”‚   (Engine)    β”‚                           β”‚
β”‚                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Test Coverage

507 tests passing covering:

  • SQL transpilation for 100+ functions
  • All DML operations (SELECT, INSERT, UPDATE, DELETE, MERGE)
  • DDL operations (CREATE, DROP, ALTER)
  • Session management
  • dbt-snowflake compatibility (37 dedicated tests)
  • Snowpipe Streaming REST API (40 tests)

License

SnowDuck is distributed under the MIT License.


Back to top

Copyright © 2026 hupe1980. Distributed under the MIT License.