Snowflake¶
Driver Version v1.10.1 Tested With Snowflake 9
This driver provides access to Snowflake , a cloud-based data warehouse platform.
Installation & Quickstart¶
The driver can be installed with dbc :
dbc install snowflake
Pre-requisites¶
Using the Snowflake driver requires a Snowflake account and authentication. See Getting Started With Snowflake for instructions.
Connecting¶
To connect, replace the Snowflake options below with the appropriate values for your situation and run the following:
from adbc_driver_manager import dbapi
conn = dbapi.connect(
driver="snowflake",
db_kwargs={
"username": "USER",
### for username/password authentication: ###
"adbc.snowflake.sql.auth_type": "auth_snowflake",
"password": "PASS",
### for JWT authentication: ###
#"adbc.snowflake.sql.auth_type": "auth_jwt",
#"adbc.snowflake.sql.client_option.jwt_private_key": "/path/to/rsa_key.p8",
"adbc.snowflake.sql.account": "ACCOUNT-IDENT",
"adbc.snowflake.sql.db": "SNOWFLAKE_SAMPLE_DATA",
"adbc.snowflake.sql.schema": "TPCH_SF1",
"adbc.snowflake.sql.warehouse": "MY_WAREHOUSE",
"adbc.snowflake.sql.role": "MY_ROLE"
}
)
Note: The example above is for Python using the adbc-driver-manager package but the process will be similar for other driver managers. See adbc-quickstarts .
The driver supports connecting with individual options or connection strings.
Connection String Format¶
Snowflake URI syntax:
snowflake://user[:password]@host[:port]/database[/schema][?param1=value1¶m2=value2]
This follows the Go Snowflake Driver Connection String format with the addition of the snowflake:// scheme.
Components:
scheme:snowflake://(required)user/password: (optional) For username/password authenticationhost: (required) The Snowflake account identifier string (e.g., myorg-account1) OR the full hostname (e.g., private.network.com ). If a full hostname is used, the actual Snowflake account identifier must be provided separately via the account query parameter (see example 3).port: The port is optional and defaults to 443.database: Database name (required)schema: Schema name (optional)Query Parameters: Additional configuration options. For a complete list of parameters, see the Go Snowflake Driver Connection Parameters
Note
Reserved characters in URI elements must be URI-encoded. For example, @ becomes %40.
Examples:
snowflake://jane.doe:MyS3cr3t!@myorg-account1/ANALYTICS_DB/SALES_DATA?warehouse=WH_XL&role=ANALYSTsnowflake://service_user@myorg-account2/RAW_DATA_LAKE?authenticator=oauth&application=ADBC_APPsnowflake://sys_admin@private.network.com:443/OPS_MONITOR/DBA?account=vpc-id-1234&insecureMode=true&client_session_keep_alive=true(Uses full hostname, requires explicit account parameter)
Feature & Type Support¶
| Feature | Support | |
|---|---|---|
| Bulk Ingestion | Create | ✅ |
| Append | ✅ | |
| Create/Append | ✅ | |
| Replace | ✅ | |
| Temporary Table | ❌ | |
| Specify target catalog | ❌ | |
| Specify target schema | ❌ | |
| Non-nullable fields are marked NOT NULL | ❌ | |
| Catalog (GetObjects) | depth=catalogs | ✅ |
| depth=db_schemas | ✅ | |
| depth=tables | ✅ | |
| depth=columns (all) | ✅ | |
| Get Parameter Schema | ❌ | |
| Get Table Schema | ✅ | |
| Prepared Statements | ✅ | |
| Transactions | ✅ | |
Types¶
Snowflake to Arrow¶
Snowflake Type |
Arrow Type |
|---|---|
BIGINT |
int64 |
BOOLEAN |
bool |
DATE |
date32[day] |
DOUBLE PRECISION |
double |
INT |
int64 |
NUMERIC |
double |
REAL |
double |
SMALLINT |
int64 |
TIME |
time64[ns] |
TIMESTAMP |
timestamp[us] |
TIMESTAMP WITH TIME ZONE |
timestamp[us] (with time zone) |
VARBINARY |
binary |
VARCHAR |
string |
Arrow to Snowflake¶
| Arrrow Type | Snowflake Type | |
|---|---|---|
| Bind | Ingest | |
| binary |
❌ |
BINARY |
| binary_view |
❌ |
|
| bool |
BOOLEAN |
|
| date32[day] |
❌ |
DATE |
| decimal128 |
❌ |
(not tested) |
| double |
DOUBLE PRECISION |
|
| fixed_size_binary |
❌ |
BINARY(n) |
| float |
REAL ⚠️ [1] |
(not tested) |
| halffloat |
REAL ⚠️ [1] |
(not tested) |
| int16 |
SMALLINT |
(not tested) |
| int32 |
INT |
(not tested) |
| int64 |
BIGINT |
|
| large_binary |
❌ |
BINARY |
| large_string |
VARCHAR ⚠️ [2] |
STRING |
| string |
VARCHAR ⚠️ [2] |
STRING |
| string_view |
VARCHAR ⚠️ [2] |
❌ |
| time32[ms] |
❌ |
TIME(3) |
| time32[s] |
❌ |
TIME(0) |
| time64[ns] |
❌ |
TIME(9) |
| time64[us] |
❌ |
TIME(6) |
| timestamp[ms] |
❌ |
TIMESTAMP_NTZ(3) |
| timestamp[ms] (with time zone) |
❌ |
TIMESTAMP_LTZ(3) |
| timestamp[ns] |
❌ |
TIMESTAMP_NTZ(9) |
| timestamp[ns] (with time zone) |
❌ |
TIMESTAMP_LTZ(9) |
| timestamp[s] |
❌ |
TIMESTAMP_NTZ(0) |
| timestamp[s] (with time zone) |
❌ |
TIMESTAMP_LTZ(0) |
| timestamp[us] |
❌ |
TIMESTAMP_NTZ(6) |
| timestamp[us] (with time zone) |
❌ |
TIMESTAMP_LTZ(6) |
Previous Versions¶
To see documentation for previous versions of this driver, see the following: