Snowflake data source extension - query Snowflake databases directly from DuckDB
Installing and Loading
INSTALL snowflake FROM community;
LOAD snowflake;
Example
-- Install and load the extension
INSTALL snowflake FROM community;
LOAD snowflake;
-- Create a Snowflake secret with password authentication
CREATE SECRET my_snowflake (
TYPE snowflake,
ACCOUNT 'your-account',
USER 'your-username',
PASSWORD 'your-password',
DATABASE 'your-database'
);
-- Query Snowflake data using pass-through query function
SELECT * FROM snowflake_query(
'SELECT * FROM customers WHERE state = ''CA''',
'my_snowflake'
);
-- Attach Snowflake database for direct SQL access
ATTACH '' AS sf (TYPE snowflake, SECRET my_snowflake, READ_ONLY);
SELECT * FROM sf.schema.customers WHERE state = 'CA';
About snowflake
This community-maintained extension allows DuckDB to connect to Snowflake using Arrow ADBC drivers. It provides seamless connectivity between DuckDB and Snowflake, supporting multiple authentication methods (password, key pair, OAuth, external browser/SSO, Okta), predicate pushdown optimization, and comprehensive SQL operations.
Features:
- Multiple authentication methods (Password, Key Pair, OAuth, External Browser/SSO, Okta)
- Direct SQL passthrough via
snowflake_query()function - ATTACH support for mounting Snowflake databases as DuckDB catalogs
- Native
GEOMETRY/GEOGRAPHYsupport via GeoArrow - Predicate pushdown optimization (optional)
- Hybrid queries: join Snowflake tables with local DuckDB tables
- Full DML read operations: SELECT with WHERE, JOIN, aggregations, subqueries
Prerequisites: The ADBC Snowflake driver must be installed separately (dbc install snowflake or the repository's installer script).
See the ADBC Driver Installation Guide
for complete setup instructions. For comprehensive usage examples, authentication methods, and
advanced features, visit the extension repository.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| snowflake_query | table | Execute a SQL query directly against a Snowflake database and return the results as a table. Uses the specified secret for authentication credentials. | NULL | [SELECT * FROM snowflake_query('SELECT * FROM customers WHERE state = ''CA''', 'my_snowflake_secret');] |
| snowflake_version | scalar | Returns the version of the Snowflake extension. | NULL | [SELECT snowflake_version();] |
| snowflake_render_pushdown_query | scalar | NULL | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases |
|---|---|---|---|---|
| snowflake_prefetch_concurrency | How many Snowflake result chunks the ADBC driver downloads in parallel. 0 (the default) leaves the driver's own default in place; max 10000. Lowering this reduces read-ahead further, but costs download throughput. | BIGINT | GLOBAL | [] |
| snowflake_result_queue_size | Maximum Arrow batches the ADBC driver buffers per Snowflake result stream. 0 (the default) leaves the driver's own default in place; max 10000. Set to 1 to throttle the driver's read-ahead when the consumer is slow (CREATE TABLE AS, COPY TO, inserts), which otherwise buffers the result outside memory_limit. | BIGINT | GLOBAL | [] |