Help us shape the future of Go! Take the 2026 Go Developer Survey

redshift

package
v0.23.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	// contains filtered or unexported methods
}

type RedshiftQueryLogSchema added in v0.5.0

type RedshiftQueryLogSchema struct {
	UserId                *int64     `db:"user_id"`
	QueryId               int64      `db:"query_id"`
	QueryLabel            *string    `db:"query_label"`
	TransactionId         *int64     `db:"transaction_id"`
	SessionId             *int64     `db:"session_id"`
	DatabaseName          *string    `db:"database_name"`
	QueryType             *string    `db:"query_type"`
	Status                *string    `db:"status"`
	ResultCacheHit        *bool      `db:"result_cache_hit"`
	StartTime             *time.Time `db:"start_time"`
	EndTime               *time.Time `db:"end_time"`
	ElapsedTime           *int64     `db:"elapsed_time"`
	QueueTime             *int64     `db:"queue_time"`
	ExecutionTime         *int64     `db:"execution_time"`
	ErrorMessage          *string    `db:"error_message"`
	ReturnedRows          *int64     `db:"returned_rows"`
	ReturnedBytes         *int64     `db:"returned_bytes"`
	QueryText             *string    `db:"query_text"`
	RedshiftVersion       *string    `db:"redshift_version"`
	UsageLimit            *string    `db:"usage_limit"`
	ComputeType           *string    `db:"compute_type"`
	CompileTime           *int64     `db:"compile_time"`
	PlanningTime          *int64     `db:"planning_time"`
	LockWaitTime          *int64     `db:"lock_wait_time"`
	ServiceClassId        *int64     `db:"service_class_id"`
	ServiceClassName      *string    `db:"service_class_name"`
	QueryPriority         *string    `db:"query_priority"`
	ShortQueryAccelerated *string    `db:"short_query_accelerated"`
	GenericQueryHash      *string    `db:"generic_query_hash"`
	UserQueryHash         *string    `db:"user_query_hash"`
	UserName              *string    `db:"user_name"`
	TextSequence          *int64     `db:"text_sequence"`
	TextChunk             *string    `db:"text_chunk"`
}

type RedshiftScrapper

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

func NewRedshiftScrapper

func NewRedshiftScrapper(ctx context.Context, conf *RedshiftScrapperConf) (*RedshiftScrapper, error)

func (*RedshiftScrapper) Capabilities added in v0.10.6

func (e *RedshiftScrapper) Capabilities() scrapper.Capabilities

func (*RedshiftScrapper) Close

func (e *RedshiftScrapper) Close() error

func (*RedshiftScrapper) DialectType added in v0.1.8

func (e *RedshiftScrapper) DialectType() string

func (*RedshiftScrapper) EstimateQuery added in v0.16.0

func (e *RedshiftScrapper) EstimateQuery(ctx context.Context, sql string) (*scrapper.QueryEstimate, error)

EstimateQuery is unsupported: Redshift's EXPLAIN reports only abstract planner cost units and cardinality, with no bytes-scanned figure to translate into a scan/cost estimate.

func (*RedshiftScrapper) Executor

func (*RedshiftScrapper) FetchQueryLogs added in v0.5.0

func (s *RedshiftScrapper) FetchQueryLogs(
	ctx context.Context,
	from, to time.Time,
	obfuscator querylogs.QueryObfuscator,
) (querylogs.QueryLogIterator, error)

func (*RedshiftScrapper) FetchTableChangeHistory added in v0.9.2

func (e *RedshiftScrapper) FetchTableChangeHistory(
	ctx context.Context,
	fqn scrapper.DwhFqn,
	from, to time.Time,
	limit int,
) ([]*scrapper.TableChangeEvent, error)

FetchTableChangeHistory returns DML events for the given table from SYS_QUERY_HISTORY, correlated with SYS_QUERY_DETAIL to filter by schema and table name.

Row counts are not available from Redshift system tables and will be nil. The Version field is the query_id, which can be used for correlation but not for Redshift time-travel (which uses AS OF TIMESTAMP, not a version number).

Note: SYS_QUERY_HISTORY has a default retention of ~5 days on Serverless and ~7 days on provisioned clusters.

func (*RedshiftScrapper) IsPermissionError added in v0.1.1

func (e *RedshiftScrapper) IsPermissionError(err error) bool

func (*RedshiftScrapper) QueryCatalog

func (e *RedshiftScrapper) QueryCatalog(ctx context.Context) ([]*scrapper.CatalogColumnRow, error)

func (*RedshiftScrapper) QueryCustomMetrics

func (e *RedshiftScrapper) QueryCustomMetrics(ctx context.Context, sql string, args ...any) ([]*scrapper.CustomMetricsRow, error)

func (*RedshiftScrapper) QueryDatabases

func (e *RedshiftScrapper) QueryDatabases(ctx context.Context) ([]*scrapper.DatabaseRow, error)

func (*RedshiftScrapper) QueryPlatformUsers added in v0.21.0

func (e *RedshiftScrapper) QueryPlatformUsers(ctx context.Context) (*scrapper.PlatformUsers, error)

QueryPlatformUsers lists every Redshift user with its groups, its directly granted roles and its last login. Nothing a grant or the cluster's version decides fails the call: a listing that could not be read is returned in its refused, unavailable or failed state, and a fact that could not be read (SVV_USER_GRANTS before RBAC, a SYS view a provisioned cluster or Serverless lacks) is skipped with the reason.

func (*RedshiftScrapper) QueryRoutines added in v0.23.0

func (e *RedshiftScrapper) QueryRoutines(ctx context.Context) ([]*scrapper.RoutineRow, error)

func (*RedshiftScrapper) QuerySchemas added in v0.14.5

func (e *RedshiftScrapper) QuerySchemas(ctx context.Context) ([]*scrapper.SchemaRow, error)

func (*RedshiftScrapper) QuerySegments

func (e *RedshiftScrapper) QuerySegments(ctx context.Context, sql string, args ...any) ([]*scrapper.SegmentRow, error)

func (*RedshiftScrapper) QueryShape added in v0.8.3

func (e *RedshiftScrapper) QueryShape(ctx context.Context, sql string) ([]*scrapper.QueryShapeColumn, error)

func (*RedshiftScrapper) QuerySqlDefinitions

func (e *RedshiftScrapper) QuerySqlDefinitions(ctx context.Context) ([]*scrapper.SqlDefinitionRow, error)

func (*RedshiftScrapper) QueryTableConstraints added in v0.9.0

func (e *RedshiftScrapper) QueryTableConstraints(ctx context.Context) ([]*scrapper.TableConstraintRow, error)

func (*RedshiftScrapper) QueryTableMetrics

func (e *RedshiftScrapper) QueryTableMetrics(ctx context.Context, lastMetricsFetchTime time.Time) ([]*scrapper.TableMetricsRow, error)

func (*RedshiftScrapper) QueryTables

func (e *RedshiftScrapper) QueryTables(ctx context.Context, opts ...scrapper.QueryTablesOption) ([]*scrapper.TableRow, error)

func (*RedshiftScrapper) RunRawQuery added in v0.13.7

func (*RedshiftScrapper) SqlDialect added in v0.1.8

func (e *RedshiftScrapper) SqlDialect() sqldialect.Dialect

func (*RedshiftScrapper) ValidateConfiguration

func (e *RedshiftScrapper) ValidateConfiguration(ctx context.Context) ([]string, error)

type RedshiftScrapperConf

type RedshiftScrapperConf struct {
	dwhexecredshift.RedshiftConf
	FreshnessFromQueryLogs bool
	// UseShowCreateTable, when true, makes QuerySqlDefinitions read each
	// table's DDL with SHOW TABLE, one statement per table, so it is opt-in
	// like UseShowCreateTable on the other platforms. Without it only views
	// have a definition.
	UseShowCreateTable bool
}

Jump to

Keyboard shortcuts

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