snowflake

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const SPNApplicationId = "SYNQ_Platform"

https://github.com/snowflakedb/gosnowflake/blob/099708d318689634a558f705ccc19b3b7b278972/doc.go#L107

Variables

This section is empty.

Functions

func EnrichSnowflakeContext added in v0.9.0

func EnrichSnowflakeContext(ctx context.Context, db *sql.DB) context.Context

EnrichSnowflakeContext wraps the context with a query ID channel so the Snowflake driver reports the query ID. Creates or reuses a DriverStats accumulator and registers an onFinish hook to collect the query ID (and optionally detailed stats) when the Collector finishes.

func IsNotFoundOrNoPermissionError added in v0.5.0

func IsNotFoundOrNoPermissionError(err error) bool

IsNotFoundOrNoPermissionError checks if the error is a Snowflake "does not exist or not authorized" error

func IsPermissionError added in v0.15.3

func IsPermissionError(err error) bool

IsPermissionError reports whether err is a Snowflake failure that is user-actionable and NOT worth retrying — callers use it to finish the job and surface the cause to the customer instead of looping with backoff. Recognises:

  • SQL compilation error 002003 with the canonical "does not exist or not authorized" message (most common shape — Snowflake intentionally conflates "no privilege" and "no such object" to prevent object-existence probing).
  • Error 003001 "Insufficient privileges to operate on ...".
  • Error 090073 "Warehouse '%s' cannot be resumed because resource monitor '%s' has exceeded its quota." — the customer's compute is capped/suspended; retrying just builds a multi-day job backlog (QUA-602). Only the customer can lift it.

This is the single source of truth for Snowflake permission classification, shared by the scrapper and the audit/query paths.

func IsUnsupportedFeatureDataLineageError added in v0.5.0

func IsUnsupportedFeatureDataLineageError(err error) bool

IsUnsupportedFeatureDataLineageError checks if the error is a Snowflake "Unsupported feature 'Data Lineage'" error

func NewQuerier

func NewQuerier[T any](conn *SnowflakeExecutor) querier.Querier[T]

Types

type Executor

type Executor interface {
	stdsql.StdSqlExecutor
	QueryRows(ctx context.Context, q string, args ...any) (*sqlx.Rows, error)
}

type Mock

type Mock struct {
	SnowflakeExecutor
	// contains filtered or unexported fields
}

func (*Mock) QueryRows

func (bq *Mock) QueryRows(ctx context.Context, q string, args ...any) (*sqlx.Rows, error)

type SnowflakeConf

type SnowflakeConf struct {
	User                 string
	Password             string
	PrivateKey           []byte
	PrivateKeyFile       string
	PrivateKeyPassphrase string
	Account              string
	Warehouse            string
	Databases            []string
	Role                 string
	// Token is an OAuth access token for token-based authentication.
	// When set, AuthTypeOAuth is used automatically.
	Token string
	// AuthType specifies the authentication method: empty (default, uses password or private_key),
	// "externalbrowser" (SSO via browser). When set to "externalbrowser", opens browser for SSO login
	// and caches the ID token locally in the OS credential manager (Keychain on macOS, Credential Manager on Windows).
	AuthType string
	// Transporter is an optional http.RoundTripper to use for the underlying HTTP client. Use [gosnowflake.SnowflakeTransport] as a base.
	Transporter http.RoundTripper
}

type SnowflakeExecutor

type SnowflakeExecutor struct {
	// contains filtered or unexported fields
}

func NewSnowflakeExecutor

func NewSnowflakeExecutor(ctx context.Context, conf *SnowflakeConf) (*SnowflakeExecutor, error)

func (*SnowflakeExecutor) Close

func (e *SnowflakeExecutor) Close() error

func (*SnowflakeExecutor) Exec

func (e *SnowflakeExecutor) Exec(ctx context.Context, query string, args ...any) error

func (*SnowflakeExecutor) GetDb

func (e *SnowflakeExecutor) GetDb() *sqlx.DB

func (*SnowflakeExecutor) QueryRows

func (e *SnowflakeExecutor) QueryRows(ctx context.Context, q string, args ...any) (*sqlx.Rows, error)

func (*SnowflakeExecutor) Select added in v0.11.0

func (e *SnowflakeExecutor) Select(ctx context.Context, dest any, query string, args ...any) error

Jump to

Keyboard shortcuts

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