Snowflake data source extension - query Snowflake databases directly from DuckDB
Maintainer(s):
iqea-ai
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, external browser/SSO, key pair), predicate pushdown optimization, and comprehensive SQL operations.
Features:
- Multiple authentication methods (Password, External Browser/SSO, Key Pair)
- Direct SQL passthrough via
snowflake_query()function - ATTACH support for mounting Snowflake databases as DuckDB catalogs
- 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 Apache Arrow ADBC Snowflake driver must be installed separately. After
installing the extension, run scripts/download_adbc_driver.sh from the extension repository
to download the platform-specific driver. For detailed setup and usage instructions, 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();] |