snowflake

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2025 License: Apache-2.0 Imports: 46 Imported by: 1

Documentation

Index

Constants

View Source
const (
	OptionDatabase  = "adbc.snowflake.sql.db"
	OptionSchema    = "adbc.snowflake.sql.schema"
	OptionWarehouse = "adbc.snowflake.sql.warehouse"
	OptionRole      = "adbc.snowflake.sql.role"
	OptionRegion    = "adbc.snowflake.sql.region"
	OptionAccount   = "adbc.snowflake.sql.account"
	OptionProtocol  = "adbc.snowflake.sql.uri.protocol"
	OptionPort      = "adbc.snowflake.sql.uri.port"
	OptionHost      = "adbc.snowflake.sql.uri.host"
	// Specify auth type to use for snowflake connection based on
	// what is supported by the snowflake driver. Default is
	// "auth_snowflake" (use OptionValueAuth* consts to specify desired
	// authentication type).
	OptionAuthType = "adbc.snowflake.sql.auth_type"
	// 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.
	OptionLoginTimeout = "adbc.snowflake.sql.client_option.login_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.
	OptionRequestTimeout = "adbc.snowflake.sql.client_option.request_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.
	OptionJwtExpireTimeout = "adbc.snowflake.sql.client_option.jwt_expire_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.
	OptionClientTimeout = "adbc.snowflake.sql.client_option.client_timeout"
	// OptionUseHighPrecision controls the data type used for NUMBER columns
	// using a FIXED size data type. By default, this is enabled and NUMBER
	// columns will be returned as Decimal128 types using the indicated
	// precision and scale of the type. If disabled, then fixed-point data
	// with a scale of 0 will be returned as Int64 columns, and a non-zero
	// scale will return a Float64 column.
	OptionUseHighPrecision = "adbc.snowflake.sql.client_option.use_high_precision"
	// OptionMaxTimestampPrecision controls the behavior of Timestamp values with
	// Nanosecond precision. Native Go behavior is these values will overflow to an
	// unpredictable value when the year is before year 1677 or after 2262. This option
	// can control the behavior of the `timestamp_ltz`, `timestamp_ntz`, and `timestamp_tz` types.
	//
	// Valid values are
	// `nanoseconds`: Use default behavior for nanoseconds.
	// `nanoseconds_error_on_overflow`: Throws an error when the value will overflow to enforce integrity of the data.
	// `microseconds`: Limits the max Timestamp precision to microseconds, which is safe for all values.
	OptionMaxTimestampPrecision = "adbc.snowflake.sql.client_option.max_timestamp_precision"

	OptionApplicationName  = "adbc.snowflake.sql.client_option.app_name"
	OptionSSLSkipVerify    = "adbc.snowflake.sql.client_option.tls_skip_verify"
	OptionOCSPFailOpenMode = "adbc.snowflake.sql.client_option.ocsp_fail_open_mode"
	// specify the token to use for OAuth or other forms of authentication
	OptionAuthToken = "adbc.snowflake.sql.client_option.auth_token"
	// specify the OKTAUrl to use for OKTA Authentication
	OptionAuthOktaUrl = "adbc.snowflake.sql.client_option.okta_url"
	// enable the session to persist even after the connection is closed
	OptionKeepSessionAlive = "adbc.snowflake.sql.client_option.keep_session_alive"
	// 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"
	OptionJwtPrivateKey = "adbc.snowflake.sql.client_option.jwt_private_key"
	// 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.
	OptionJwtPrivateKeyPkcs8Value = "adbc.snowflake.sql.client_option.jwt_private_key_pkcs8_value"
	// a passcode to use with encrypted private keys for JWT authentication
	OptionJwtPrivateKeyPkcs8Password = "adbc.snowflake.sql.client_option.jwt_private_key_pkcs8_password"
	OptionDisableTelemetry           = "adbc.snowflake.sql.client_option.disable_telemetry"
	// snowflake driver logging level
	OptionLogTracing = "adbc.snowflake.sql.client_option.tracing"
	// snowflake driver client logging config file
	OptionClientConfigFile = "adbc.snowflake.sql.client_option.config_file"
	// When true, the MFA token is cached in the credential manager. True by default
	// on Windows/OSX, false for Linux
	OptionClientRequestMFAToken = "adbc.snowflake.sql.client_option.cache_mfa_token"
	// When true, the ID token is cached in the credential manager. True by default
	// on Windows/OSX, false for Linux
	OptionClientStoreTempCred = "adbc.snowflake.sql.client_option.store_temp_creds"
	// Specify the identity provider to utilize for generating a workload identity
	// federation attestation. Must be set when using OptionValueAuthWIF.
	OptionIdentityProvider = "adbc.snowflake.sql.client_option.identity_provider"

	// auth types are implemented by the Snowflake driver in gosnowflake
	// general username password authentication
	OptionValueAuthSnowflake = "auth_snowflake"
	// use OAuth authentication for snowflake connection
	OptionValueAuthOAuth = "auth_oauth"
	// use an external browser to access a FED and perform SSO auth
	OptionValueAuthExternalBrowser = "auth_ext_browser"
	// use a native OKTA URL to perform SSO authentication on Okta
	OptionValueAuthOkta = "auth_okta"
	// use a JWT to perform authentication
	OptionValueAuthJwt = "auth_jwt"
	// use a username and password with mfa
	OptionValueAuthUserPassMFA = "auth_mfa"
	// use a programmatic access token
	OptionValueAuthPat = "auth_pat"
	// use Workload Identity Federation for auth, must also use option to specify the provider
	OptionValueAuthWIF = "auth_wif"

	// Use default behavior for nanoseconds.
	OptionValueNanoseconds = "nanoseconds"
	// throws an error when the value will overflow to enforce integrity of the data.
	OptionValueNanosecondsNoOverflow = "nanoseconds_error_on_overflow"
	// use a max of microseconds precision for timestamps
	OptionValueMicroseconds = "microseconds"
)
View Source
const (
	OptionStatementQueryTag                = "adbc.snowflake.statement.query_tag"
	OptionStatementQueueSize               = "adbc.rpc.result_queue_size"
	OptionStatementPrefetchConcurrency     = "adbc.snowflake.rpc.prefetch_concurrency"
	OptionStatementIngestWriterConcurrency = "adbc.snowflake.statement.ingest_writer_concurrency"
	OptionStatementIngestUploadConcurrency = "adbc.snowflake.statement.ingest_upload_concurrency"
	OptionStatementIngestCopyConcurrency   = "adbc.snowflake.statement.ingest_copy_concurrency"
	OptionStatementIngestTargetFileSize    = "adbc.snowflake.statement.ingest_target_file_size"
	OptionStatementIngestCompressionCodec  = "adbc.snowflake.statement.ingest_compression_codec" // TODO(GH-1473): Implement option
	OptionStatementIngestCompressionLevel  = "adbc.snowflake.statement.ingest_compression_level" // TODO(GH-1473): Implement option
)
View Source
const MetadataKeySnowflakeType = "SNOWFLAKE_TYPE"
View Source
const (
	// Base table or view not found
	SQLStateTableOrViewNotFound = "42S02"
)

SQLSTATE codes https://learn.microsoft.com/en-us/sql/odbc/reference/appendixes/appendix-a-odbc-error-codes

Variables

View Source
var (
	ErrNoRecordsInStream = errors.New("no records in stream to write")
)

Functions

func DefaultIngestOptions added in v0.10.0

func DefaultIngestOptions() *ingestOptions

Types

type Driver

type Driver interface {
	adbc.Driver

	// NewDatabaseWithOptions creates a new Snowflake database with the provided options.
	NewDatabaseWithOptions(map[string]string, ...Option) (adbc.Database, error)
	NewDatabaseWithOptionsContext(context.Context, map[string]string, ...Option) (adbc.Database, error)
}

Driver is the Snowflake driver interface.

It extends the base adbc.Driver to provide additional options when creating the Snowflake database.

func NewDriver added in v0.8.0

func NewDriver(alloc memory.Allocator) Driver

NewDriver creates a new Snowflake driver using the given Arrow allocator.

type MaxTimestampPrecision added in v1.7.0

type MaxTimestampPrecision uint8
const (
	// default precision
	Nanoseconds MaxTimestampPrecision = iota

	// use nanoseconds, but error if there is an overflow
	NanosecondsNoOverflow

	// use microseconds
	Microseconds
)

type Option added in v1.5.0

type Option func(*config) error

Option is a function type to set custom driver configurations.

It is intended for configurations that cannot be provided from the standard options map, e.g. the underlying HTTP transporter.

func WithTransporter added in v1.5.0

func WithTransporter(transporter http.RoundTripper) Option

WithTransporter sets the custom transporter to use for the Snowflake connection. This allows to intercept HTTP requests and responses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL