adbc_driver_snowflake

Low-Level API

Low-level ADBC bindings for the Snowflake driver.

class adbc_driver_snowflake.DatabaseOptions(*values)

Bases: Enum

Database options specific to the Flight SQL driver.

ACCOUNT = 'adbc.snowflake.sql.account'
APPLICATION_NAME = 'adbc.snowflake.sql.client_option.app_name'
AUTH_OKTA_URL = 'adbc.snowflake.sql.client_option.okta_url'

specify the OKTAUrl to use for OKTA Authentication

AUTH_TOKEN = 'adbc.snowflake.sql.client_option.auth_token'

specify the token to use for OAuth or other forms of authentication

AUTH_TYPE = 'adbc.snowflake.sql.auth_type'

Specify auth type to use for snowflake connection based on what is supported by the snowflake driver. Default is “auth_snowflake” (use ValueAuth* consts to specify desired authentication type).

CLIENT_REQUEST_MFA_TOKEN = 'adbc.snowflake.sql.client_option.cache_mfa_token'

When true, the MFA token is cached in the credential manager. True by default on Windows/OSX, false for Linux

CLIENT_STORE_TEMP_CRED = 'adbc.snowflake.sql.client_option.store_temp_creds'

When true, the ID token is cached in the credential manager. True by default on Windows/OSX, false for Linux

CLIENT_TIMEOUT = 'adbc.snowflake.sql.client_option.client_timeout'

Timeout for network round trip + reading http response use format like http://pkg.go.dev/time#ParseDuration such as “300ms”, “1.5s” or “1m30s”. ParseDuration accepts negative values but the absolute value will be used.

DATABASE = 'adbc.snowflake.sql.db'
DISABLE_TELEMETRY = 'adbc.snowflake.sql.client_option.disable_telemetry'
HOST = 'adbc.snowflake.sql.uri.host'
JWT_EXPIRE_TIMEOUT = 'adbc.snowflake.sql.client_option.jwt_expire_timeout'

JWT expiration after timeout use format like http://pkg.go.dev/time#ParseDuration such as “300ms”, “1.5s” or “1m30s”. ParseDuration accepts negative values but the absolute value will be used.

JWT_PRIVATE_KEY = 'adbc.snowflake.sql.client_option.jwt_private_key'

specify the RSA private key to use to sign the JWT this should point to a file containing a PKCS1 private key to be loaded. Commonly encoded in PEM blocks of type “RSA PRIVATE KEY”

JWT_PRIVATE_KEY_PASSWORD = 'adbc.snowflake.sql.client_option.jwt_private_key_pkcs8_password'

a passcode to use with encrypted private keys for JWT authentication.

JWT_PRIVATE_KEY_VALUE = 'adbc.snowflake.sql.client_option.jwt_private_key_pkcs8_value'

parses a private key in PKCS #8, ASN.1 DER form. Specify the private key value without having to load it from the file system.

KEEP_SESSION_ALIVE = 'adbc.snowflake.sql.client_option.keep_session_alive'

Login retry timeout EXCLUDING network roundtrip and reading http response use format like http://pkg.go.dev/time#ParseDuration such as “300ms”, “1.5s” or “1m30s”. ParseDuration accepts negative values but the absolute value will be used. enable the session to persist even after the connection is closed

LOGIN_TIMEOUT = 'adbc.snowflake.sql.client_option.login_timeout'
OCSP_FAIL_OPEN_MODE = 'adbc.snowflake.sql.client_option.ocsp_fail_open_mode'
PORT = 'adbc.snowflake.sql.uri.port'
PROTOCOL = 'adbc.snowflake.sql.uri.protocol'
REGION = 'adbc.snowflake.sql.region'
REQUEST_TIMEOUT = 'adbc.snowflake.sql.client_option.request_timeout'

request retry timeout EXCLUDING network roundtrip and reading http response use format like http://pkg.go.dev/time#ParseDuration such as “300ms”, “1.5s” or “1m30s”. ParseDuration accepts negative values but the absolute value will be used.

ROLE = 'adbc.snowflake.sql.role'
SCHEMA = 'adbc.snowflake.sql.schema'
SSL_SKIP_VERIFY = 'adbc.snowflake.sql.client_option.tls_skip_verify'
USE_HIGH_PRECISION = 'adbc.snowflake.sql.client_option.use_high_precision'

control the data type which will be used for NUMBER columns that use a FIXED data type. By default, this is enabled and NUMBER columns will all be returned as Decimal128 columns using the precision and scale of the NUMBER type. If disabled, fixed-point data types with a scale of 0 will be returned as Int64 columns, and a non-zero scale will be returned as a Float64 column. This option must be set using ‘true’ or ‘false’.

WAREHOUSE = 'adbc.snowflake.sql.warehouse'
class adbc_driver_snowflake.StatementOptions(*values)

Bases: Enum

Statement options specific to the Snowflake driver.

INGEST_COPY_CONCURRENCY = 'adbc.snowflake.statement.ingest_copy_concurrency'

Maximum number of COPY operations to run concurrently for bulk ingestion. Bulk ingestion performance is optimized by executing COPY queries as files are still being uploaded, Snowflake COPY speed scales with warehouse size. So smaller warehouses might benefit from a higher setting to prevent a long-running COPY query from blocking others from being loaded. Default is 4.

INGEST_TARGET_FILE_SIZE = 'adbc.snowflake.statement.ingest_target_file_size'

Approximate size of Parquet files written during ingestion. Actual size will be slightly larger due to size of footer/metadata. Does not account for batch size, so if the input stream produces very large batches, you’ll get similar sized parquet files. Default is 10MB

INGEST_UPLOAD_CONCURRENCY = 'adbc.snowflake.statement.ingest_upload_concurrency'

Number of parquet files to upload in parallel. Greater concurrency can smooth out congestion and make use of available network bandwidth but will increase memory utilization. Cannot be negative. Defaults to 8

INGEST_WRITER_CONCURRENCY = 'adbc.snowflake.statement.ingest_writer_concurrency'

Number of parquet files to write in parallel for bulk ingestion Defaults to NumCPU

PREFETCH_CONCURRENCY = 'adbc.snowflake.rpc.prefetch_concurrency'

Number of concurrent streams being prefetched for a result set. Defaults to 10.

QUERY_TAG = 'adbc.snowflake.statement.query_tag'

An identifier for a query/queries that can be used to find the query in the query history. Use a blank string to unset the tag.

RESULT_QUEUE_SIZE = 'adbc.rpc.result_queue_size'

The number of batches queued up at a time. Defaults to 200.

adbc_driver_snowflake.connect(uri: str | None = None, db_kwargs: Dict[str, str] | None = None) AdbcDatabase

Create a low level ADBC connection to Snowflake.

Parameters:
uristr

The URI to connect to.

db_kwargsdict, optional

Initial database connection parameters.

DBAPI 2.0 API

DBAPI 2.0-compatible facade for the ADBC Snowflake driver.

adbc_driver_snowflake.dbapi.connect(uri: str | None = None, db_kwargs: Dict[str, str] | None = None, conn_kwargs: Dict[str, str] | None = None, **kwargs) Connection

Connect to Snowflake via ADBC.

Parameters:
uristr, optional

The URI to connect to.

db_kwargsdict, optional

Initial database connection parameters.

conn_kwargsdict, optional

Connection-specific parameters. (ADBC differentiates between a ‘database’ object shared between multiple ‘connection’ objects.)