Documentation
¶
Index ¶
- type Executor
- type RedshiftQueryLogSchema
- type RedshiftScrapper
- func (e *RedshiftScrapper) Capabilities() scrapper.Capabilities
- func (e *RedshiftScrapper) Close() error
- func (e *RedshiftScrapper) DialectType() string
- func (e *RedshiftScrapper) EstimateQuery(ctx context.Context, sql string) (*scrapper.QueryEstimate, error)
- func (e *RedshiftScrapper) Executor() *dwhexecredshift.RedshiftExecutor
- func (s *RedshiftScrapper) FetchQueryLogs(ctx context.Context, from, to time.Time, obfuscator querylogs.QueryObfuscator) (querylogs.QueryLogIterator, error)
- func (e *RedshiftScrapper) FetchTableChangeHistory(ctx context.Context, fqn scrapper.DwhFqn, from, to time.Time, limit int) ([]*scrapper.TableChangeEvent, error)
- func (e *RedshiftScrapper) IsPermissionError(err error) bool
- func (e *RedshiftScrapper) QueryCatalog(ctx context.Context) ([]*scrapper.CatalogColumnRow, error)
- func (e *RedshiftScrapper) QueryCustomMetrics(ctx context.Context, sql string, args ...any) ([]*scrapper.CustomMetricsRow, error)
- func (e *RedshiftScrapper) QueryDatabases(ctx context.Context) ([]*scrapper.DatabaseRow, error)
- func (e *RedshiftScrapper) QueryInstanceIdentity(ctx context.Context) (*scrapper.InstanceIdentity, error)
- func (e *RedshiftScrapper) QueryPlatformUsers(ctx context.Context) (*scrapper.PlatformUsers, error)
- func (e *RedshiftScrapper) QueryRoutines(ctx context.Context) ([]*scrapper.RoutineRow, error)
- func (e *RedshiftScrapper) QuerySchemas(ctx context.Context) ([]*scrapper.SchemaRow, error)
- func (e *RedshiftScrapper) QuerySegments(ctx context.Context, sql string, args ...any) ([]*scrapper.SegmentRow, error)
- func (e *RedshiftScrapper) QueryShape(ctx context.Context, sql string) ([]*scrapper.QueryShapeColumn, error)
- func (e *RedshiftScrapper) QuerySqlDefinitions(ctx context.Context) ([]*scrapper.SqlDefinitionRow, error)
- func (e *RedshiftScrapper) QueryTableConstraints(ctx context.Context) ([]*scrapper.TableConstraintRow, error)
- func (e *RedshiftScrapper) QueryTableMetrics(ctx context.Context, lastMetricsFetchTime time.Time) ([]*scrapper.TableMetricsRow, error)
- func (e *RedshiftScrapper) QueryTables(ctx context.Context, opts ...scrapper.QueryTablesOption) ([]*scrapper.TableRow, error)
- func (e *RedshiftScrapper) RunRawQuery(ctx context.Context, sql string) (scrapper.RawQueryRowIterator, error)
- func (e *RedshiftScrapper) SqlDialect() sqldialect.Dialect
- func (e *RedshiftScrapper) ValidateConfiguration(ctx context.Context) ([]string, error)
- type RedshiftScrapperConf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 (e *RedshiftScrapper) Executor() *dwhexecredshift.RedshiftExecutor
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) QueryInstanceIdentity ¶ added in v0.27.0
func (e *RedshiftScrapper) QueryInstanceIdentity(ctx context.Context) (*scrapper.InstanceIdentity, error)
QueryInstanceIdentity asks the warehouse which namespace it serves.
One cluster is reachable under several hostnames: its AWS endpoint, a Redshift-managed VPC endpoint, a CNAME the customer runs. Tools report whichever one they connect through, so two of them can name one cluster differently. The namespace is the same through all of them, which makes it the value a caller can join the hostnames on.
Redshift reports no hostname for itself, so Hosts is always empty.
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 (*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 (e *RedshiftScrapper) RunRawQuery(ctx context.Context, sql string) (scrapper.RawQueryRowIterator, error)
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
}
Source Files
¶
- query_catalog.go
- query_custom_metrics.go
- query_databases.go
- query_estimate.go
- query_instance_identity.go
- query_logs.go
- query_platform_users.go
- query_routines.go
- query_schemas.go
- query_segments.go
- query_shape.go
- query_sql_definitions.go
- query_table_constraints.go
- query_table_metrics.go
- query_tables.go
- redshift.go
- run_raw_query.go
- system_objects.go
- table_change_history.go