Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Snowflake Emulator – Local Snowflake Development with Go and DuckDB (github.com/nnnkkk7)
5 points by sr-white 8 days ago | hide | past | favorite | 4 comments
Hi HN! I built a Snowflake emulator for local development and testing.

Testing Snowflake code locally is frustrating – you need a real account (expensive) or mock everything (tedious). I wanted something that just works with the standard [gosnowflake](https://github.com/snowflakedb/gosnowflake) driver or REST API.

snowflake-emulator fixes this by:

- Using DuckDB as the storage engine - Auto-translating Snowflake SQL (IFF→IF, NVL→COALESCE, DATEADD, etc.) - Supporting gosnowflake driver protocol – no code changes needed - Providing REST API v2 – use from any language (Python, Node.js, etc.)

```go dsn := "user:pass@localhost:8080/TEST_DB/PUBLIC?account=test&protocol=http" db, _ := sql.Open("snowflake", dsn) db.Query(`SELECT IFF(score >= 90, 'A', 'B') FROM users`) ```

```bash docker run -p 8080:8080 ghcr.io/nnnkkk7/snowflake-emulator:latest ```

GitHub: https://github.com/nnnkkk7/snowflake-emulator

Would love feedback – especially on SQL functions you'd want supported!





how well does the flatten() translation work in practice? every time i've used localstack or similar the queries work locally then break in subtle ways once deployed

Good question! Currently FLATTEN does a simple translation to DuckDB's UNNEST, which works for basic array expansion but won't give you the full Snowflake output columns (SEQ, KEY, PATH, INDEX, VALUE, THIS) or the named parameter syntax (input => ...). That said, a more complete implementation is definitely doable — DuckDB has the primitives (unnest, generate_subscripts, json_each) to build this properly. If this is something you'd find useful, feel free to open an issue with your use case. Happy to prioritize it if there's demand!

Nice! I'll give it a try!

Thank you!



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: