Documentation
¶
Index ¶
- Constants
- func EnrichSnowflakeContext(ctx context.Context, db *sql.DB) context.Context
- func IsNotFoundOrNoPermissionError(err error) bool
- func IsPermissionError(err error) bool
- func IsUnsupportedFeatureDataLineageError(err error) bool
- func NewQuerier[T any](conn *SnowflakeExecutor) querier.Querier[T]
- type Executor
- type Mock
- type SnowflakeConf
- type SnowflakeExecutor
- func (e *SnowflakeExecutor) Close() error
- func (e *SnowflakeExecutor) Exec(ctx context.Context, query string, args ...any) error
- func (e *SnowflakeExecutor) GetDb() *sqlx.DB
- func (e *SnowflakeExecutor) QueryRows(ctx context.Context, q string, args ...any) (*sqlx.Rows, error)
- func (e *SnowflakeExecutor) Select(ctx context.Context, dest any, query string, args ...any) error
Constants ¶
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
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
IsNotFoundOrNoPermissionError checks if the error is a Snowflake "does not exist or not authorized" error
func IsPermissionError ¶ added in v0.15.3
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
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 Mock ¶
type Mock struct {
SnowflakeExecutor
// contains filtered or unexported fields
}
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) GetDb ¶
func (e *SnowflakeExecutor) GetDb() *sqlx.DB