mssql

package
v0.22.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MSSQLQueryLogSchema added in v0.12.0

type MSSQLQueryLogSchema struct {
	Database             string     `db:"database"`
	QueryId              int64      `db:"query_id"`
	QueryHash            *int64     `db:"query_hash"`
	QuerySqlText         *string    `db:"query_sql_text"`
	ExecutionType        int        `db:"execution_type"`
	CountExecutions      int64      `db:"count_executions"`
	FirstExecutionTime   *time.Time `db:"first_execution_time"`
	LastExecutionTime    *time.Time `db:"last_execution_time"`
	AvgDurationUs        *float64   `db:"avg_duration_us"`
	LastDurationUs       *float64   `db:"last_duration_us"`
	AvgCpuTimeUs         *float64   `db:"avg_cpu_time_us"`
	AvgLogicalIoReads    *float64   `db:"avg_logical_io_reads"`
	AvgLogicalIoWrites   *float64   `db:"avg_logical_io_writes"`
	AvgPhysicalIoReads   *float64   `db:"avg_physical_io_reads"`
	AvgRowcount          *float64   `db:"avg_rowcount"`
	AvgQueryMaxUsedMemKb *float64   `db:"avg_query_max_used_memory_kb"`
	PlanId               int64      `db:"plan_id"`
	IntervalStart        *time.Time `db:"interval_start"`
	IntervalEnd          *time.Time `db:"interval_end"`
}

MSSQLQueryLogSchema maps columns from the Query Store runtime stats query. Query Store aggregates execution statistics per plan per time interval, so each row represents a plan's stats during one interval (not a single execution), summed over every session that ran it: Query Store keeps no user or login.

type MSSQLScrapper

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

func NewMSSQLScrapper

func NewMSSQLScrapper(ctx context.Context, conf *MSSQLScrapperConf) (*MSSQLScrapper, error)

func (*MSSQLScrapper) Capabilities added in v0.10.6

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

func (*MSSQLScrapper) Close

func (e *MSSQLScrapper) Close() error

func (*MSSQLScrapper) DialectType

func (e *MSSQLScrapper) DialectType() string

func (*MSSQLScrapper) EstimateQuery added in v0.16.0

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

EstimateQuery is unsupported for now. SQL Server's estimated plan comes from `SET SHOWPLAN_XML ON`, a session-mode toggle that returns the plan as an XML document rather than a queryable estimate, and the EstimateRows/ EstimatedDataSize attributes depend on current statistics. Returning ErrUnsupported until a validation spike confirms a reliable parse.

func (*MSSQLScrapper) Executor added in v0.12.0

func (e *MSSQLScrapper) Executor() *dwhexecmssql.MSSQLExecutor

func (*MSSQLScrapper) FetchQueryLogs added in v0.12.0

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

func (*MSSQLScrapper) IsPermissionError

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

func (*MSSQLScrapper) QueryCatalog

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

func (*MSSQLScrapper) QueryCustomMetrics

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

func (*MSSQLScrapper) QueryDatabases

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

func (*MSSQLScrapper) QueryPlatformUsers added in v0.21.0

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

QueryPlatformUsers lists the server's logins (query history and sessions report the login name), plus the database's users that authenticate without a login. The catalog views are readable by everyone, so the listing is practically never refused; without VIEW ANY DEFINITION it shows only the connecting login and sa, and says so. Should the listing itself fail, it is refused, unavailable (a catalog view or column this version or edition lacks) or failed as its error says; the visibility check and the role memberships are best effort.

func (*MSSQLScrapper) QuerySchemas added in v0.14.5

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

func (*MSSQLScrapper) QuerySegments

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

func (*MSSQLScrapper) QueryShape

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

func (*MSSQLScrapper) QuerySqlDefinitions

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

func (*MSSQLScrapper) QueryTableConstraints

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

func (*MSSQLScrapper) QueryTableMetrics

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

func (*MSSQLScrapper) QueryTables

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

func (*MSSQLScrapper) RunRawQuery added in v0.13.7

func (*MSSQLScrapper) SqlDialect

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

func (*MSSQLScrapper) ValidateConfiguration

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

type MSSQLScrapperConf

type MSSQLScrapperConf struct {
	dwhexecmssql.MSSQLConf
}

Jump to

Keyboard shortcuts

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