scrapper

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package scrapper is a generated GoMock package.

Index

Constants

View Source
const (
	ConstraintTypePrimaryKey      = "PRIMARY KEY"
	ConstraintTypeUniqueIndex     = "UNIQUE INDEX"
	ConstraintTypeIndex           = "INDEX"
	ConstraintTypeSortingKey      = "SORTING KEY"
	ConstraintTypePartitionBy     = "PARTITION BY"
	ConstraintTypeClusterBy       = "CLUSTER BY"
	ConstraintTypeDistributionKey = "DISTRIBUTION KEY"
	ConstraintTypeProjection      = "PROJECTION"
)

Constraint type constants

Variables

View Source
var ErrUnsupported = errors.New("unsupported")

Functions

func GetTableRowOption added in v0.4.13

func GetTableRowOption[T any](tableRow *TableRow, optionName string) T

Types

type Annotation added in v0.4.12

type Annotation struct {
	AnnotationName  string `json:"annotation_name"`
	AnnotationValue string `json:"annotation_value"`
}

type BigIntValue added in v0.9.0

type BigIntValue big.Int

BigIntValue represents arbitrary precision integers (e.g., DuckDB hugeint, uint128)

func NewBigIntValue added in v0.9.0

func NewBigIntValue(v *big.Int) *BigIntValue

NewBigIntValue creates a BigIntValue from a *big.Int

func (*BigIntValue) BigInt added in v0.9.0

func (v *BigIntValue) BigInt() *big.Int

BigInt returns the underlying *big.Int

func (*BigIntValue) String added in v0.9.0

func (v *BigIntValue) String() string

String returns the string representation of the big integer

type Capabilities added in v0.10.6

type Capabilities struct {
	// ConstraintsViaQueryTables indicates that QueryTables with WithConstraints()
	// populates TableRow.Constraints, making a separate QueryTableConstraints call unnecessary.
	ConstraintsViaQueryTables bool
}

Capabilities describes what a scrapper supports beyond the base interface. Callers can use this to skip redundant calls (e.g., skip QueryTableConstraints when constraints are already provided via QueryTables).

type CatalogColumnRow

type CatalogColumnRow struct {
	Instance           string  `db:"instance"             json:"instance"             ch:"instance"             bigquery:"instance"`
	Database           string  `db:"database"             json:"database"             ch:"_database"            bigquery:"database"`
	Schema             string  `db:"schema"               json:"schema"               ch:"schema"               bigquery:"schema"`
	Table              string  `db:"table"                json:"table"                ch:"table"                bigquery:"table"`
	IsView             bool    `db:"is_view"              json:"is_view"              ch:"is_view"              bigquery:"is_view"`
	IsTable            bool    `db:"is_table"             json:"is_table"             ch:"is_table"             bigquery:"is_table"`
	IsMaterializedView bool    `db:"is_materialized_view" json:"is_materialized_view" ch:"is_materialized_view" bigquery:"is_materialized_view"`
	TableType          string  `db:"table_type"           json:"table_type"           ch:"table_type"           bigquery:"table_type"`
	Column             string  `db:"column"               json:"column"               ch:"column"               bigquery:"column"`
	Type               string  `db:"type"                 json:"type"                 ch:"type"                 bigquery:"type"`
	Position           int32   `db:"position"             json:"position"             ch:"position"             bigquery:"position"`
	Comment            *string `db:"comment"              json:"comment"              ch:"comment"              bigquery:"comment"`
	TableComment       *string `db:"table_comment"        json:"table_comment"        ch:"table_comment"        bigquery:"table_comment"`
	ColumnTags         []*Tag  `                          json:"column_tags"`
	TableTags          []*Tag  `                          json:"table_tags"`
	IsStructColumn     bool    `db:"is_struct_column"     json:"is_struct_column"     ch:"is_struct_column"     bigquery:"is_struct_column"`
	IsArrayColumn      bool    `db:"is_array_column"      json:"is_array_column"      ch:"is_array_column"      bigquery:"is_array_column"`
	FieldSchemas       []*SchemaColumnField
}

func (CatalogColumnRow) GetComment

func (r CatalogColumnRow) GetComment() string

func (CatalogColumnRow) GetTableComment

func (r CatalogColumnRow) GetTableComment() string

func (CatalogColumnRow) TableFqn

func (r CatalogColumnRow) TableFqn() DwhFqn

type ColumnValue

type ColumnValue struct {
	Name   string
	Value  Value
	IsNull bool
}

type CustomMetricsRow

type CustomMetricsRow struct {
	Segments     []*SegmentValue
	ColumnValues []*ColumnValue
}

type DatabaseRow

type DatabaseRow struct {
	Instance      string  `db:"instance"       json:"instance"       ch:"instance"       bigquery:"instance"`
	Database      string  `db:"database"       json:"database"       ch:"_database"      bigquery:"database"`
	Description   *string `db:"description"    json:"description"    ch:"description"    bigquery:"description"`
	DatabaseType  *string `db:"database_type"  json:"database_type"  ch:"database_type"  bigquery:"database_type"`
	DatabaseOwner *string `db:"database_owner" json:"database_owner" ch:"database_owner" bigquery:"database_owner"`
}

func (*DatabaseRow) SetInstance

func (r *DatabaseRow) SetInstance(instance string)

type DoubleValue

type DoubleValue float64

type DwhFqn

type DwhFqn struct {
	InstanceName string
	DatabaseName string
	SchemaName   string
	ObjectName   string
}

type HasTableFqn

type HasTableFqn interface {
	TableFqn() DwhFqn
}

type IgnoredValue

type IgnoredValue struct{}

type IntValue

type IntValue int64

type MockScrapper added in v0.4.7

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

MockScrapper is a mock of Scrapper interface.

func NewMockScrapper added in v0.4.7

func NewMockScrapper(ctrl *gomock.Controller) *MockScrapper

NewMockScrapper creates a new mock instance.

func (*MockScrapper) Capabilities added in v0.10.6

func (m *MockScrapper) Capabilities() Capabilities

Capabilities mocks base method.

func (*MockScrapper) Close added in v0.4.7

func (m *MockScrapper) Close() error

Close mocks base method.

func (*MockScrapper) DialectType added in v0.4.7

func (m *MockScrapper) DialectType() string

DialectType mocks base method.

func (*MockScrapper) EXPECT added in v0.4.7

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockScrapper) IsPermissionError added in v0.4.7

func (m *MockScrapper) IsPermissionError(err error) bool

IsPermissionError mocks base method.

func (*MockScrapper) QueryCatalog added in v0.4.7

func (m *MockScrapper) QueryCatalog(ctx context.Context) ([]*CatalogColumnRow, error)

QueryCatalog mocks base method.

func (*MockScrapper) QueryCustomMetrics added in v0.4.7

func (m *MockScrapper) QueryCustomMetrics(ctx context.Context, sql string, args ...any) ([]*CustomMetricsRow, error)

QueryCustomMetrics mocks base method.

func (*MockScrapper) QueryDatabases added in v0.4.7

func (m *MockScrapper) QueryDatabases(ctx context.Context) ([]*DatabaseRow, error)

QueryDatabases mocks base method.

func (*MockScrapper) QuerySegments added in v0.4.7

func (m *MockScrapper) QuerySegments(ctx context.Context, sql string, args ...any) ([]*SegmentRow, error)

QuerySegments mocks base method.

func (*MockScrapper) QueryShape added in v0.8.3

func (m *MockScrapper) QueryShape(ctx context.Context, sql string) ([]*QueryShapeColumn, error)

QueryShape mocks base method.

func (*MockScrapper) QuerySqlDefinitions added in v0.4.7

func (m *MockScrapper) QuerySqlDefinitions(ctx context.Context) ([]*SqlDefinitionRow, error)

QuerySqlDefinitions mocks base method.

func (*MockScrapper) QueryTableConstraints added in v0.9.0

func (m *MockScrapper) QueryTableConstraints(ctx context.Context) ([]*TableConstraintRow, error)

QueryTableConstraints mocks base method.

func (*MockScrapper) QueryTableMetrics added in v0.4.7

func (m *MockScrapper) QueryTableMetrics(ctx context.Context, lastMetricsFetchTime time.Time) ([]*TableMetricsRow, error)

QueryTableMetrics mocks base method.

func (*MockScrapper) QueryTables added in v0.4.7

func (m *MockScrapper) QueryTables(ctx context.Context, opts ...QueryTablesOption) ([]*TableRow, error)

QueryTables mocks base method.

func (*MockScrapper) SqlDialect added in v0.4.7

func (m *MockScrapper) SqlDialect() sqldialect.Dialect

SqlDialect mocks base method.

func (*MockScrapper) ValidateConfiguration added in v0.4.7

func (m *MockScrapper) ValidateConfiguration(ctx context.Context) ([]string, error)

ValidateConfiguration mocks base method.

type MockScrapperCapabilitiesCall added in v0.10.6

type MockScrapperCapabilitiesCall struct {
	*gomock.Call
}

MockScrapperCapabilitiesCall wrap *gomock.Call

func (*MockScrapperCapabilitiesCall) Do added in v0.10.6

Do rewrite *gomock.Call.Do

func (*MockScrapperCapabilitiesCall) DoAndReturn added in v0.10.6

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperCapabilitiesCall) Return added in v0.10.6

Return rewrite *gomock.Call.Return

type MockScrapperCloseCall added in v0.4.7

type MockScrapperCloseCall struct {
	*gomock.Call
}

MockScrapperCloseCall wrap *gomock.Call

func (*MockScrapperCloseCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperCloseCall) DoAndReturn added in v0.4.7

func (c *MockScrapperCloseCall) DoAndReturn(f func() error) *MockScrapperCloseCall

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperCloseCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperDialectTypeCall added in v0.4.7

type MockScrapperDialectTypeCall struct {
	*gomock.Call
}

MockScrapperDialectTypeCall wrap *gomock.Call

func (*MockScrapperDialectTypeCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperDialectTypeCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperDialectTypeCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperIsPermissionErrorCall added in v0.4.7

type MockScrapperIsPermissionErrorCall struct {
	*gomock.Call
}

MockScrapperIsPermissionErrorCall wrap *gomock.Call

func (*MockScrapperIsPermissionErrorCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperIsPermissionErrorCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperIsPermissionErrorCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperMockRecorder added in v0.4.7

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

MockScrapperMockRecorder is the mock recorder for MockScrapper.

func (*MockScrapperMockRecorder) Capabilities added in v0.10.6

Capabilities indicates an expected call of Capabilities.

func (*MockScrapperMockRecorder) Close added in v0.4.7

Close indicates an expected call of Close.

func (*MockScrapperMockRecorder) DialectType added in v0.4.7

DialectType indicates an expected call of DialectType.

func (*MockScrapperMockRecorder) IsPermissionError added in v0.4.7

IsPermissionError indicates an expected call of IsPermissionError.

func (*MockScrapperMockRecorder) QueryCatalog added in v0.4.7

QueryCatalog indicates an expected call of QueryCatalog.

func (*MockScrapperMockRecorder) QueryCustomMetrics added in v0.4.7

func (mr *MockScrapperMockRecorder) QueryCustomMetrics(ctx, sql any, args ...any) *MockScrapperQueryCustomMetricsCall

QueryCustomMetrics indicates an expected call of QueryCustomMetrics.

func (*MockScrapperMockRecorder) QueryDatabases added in v0.4.7

QueryDatabases indicates an expected call of QueryDatabases.

func (*MockScrapperMockRecorder) QuerySegments added in v0.4.7

func (mr *MockScrapperMockRecorder) QuerySegments(ctx, sql any, args ...any) *MockScrapperQuerySegmentsCall

QuerySegments indicates an expected call of QuerySegments.

func (*MockScrapperMockRecorder) QueryShape added in v0.8.3

func (mr *MockScrapperMockRecorder) QueryShape(ctx, sql any) *MockScrapperQueryShapeCall

QueryShape indicates an expected call of QueryShape.

func (*MockScrapperMockRecorder) QuerySqlDefinitions added in v0.4.7

QuerySqlDefinitions indicates an expected call of QuerySqlDefinitions.

func (*MockScrapperMockRecorder) QueryTableConstraints added in v0.9.0

func (mr *MockScrapperMockRecorder) QueryTableConstraints(ctx any) *MockScrapperQueryTableConstraintsCall

QueryTableConstraints indicates an expected call of QueryTableConstraints.

func (*MockScrapperMockRecorder) QueryTableMetrics added in v0.4.7

func (mr *MockScrapperMockRecorder) QueryTableMetrics(ctx, lastMetricsFetchTime any) *MockScrapperQueryTableMetricsCall

QueryTableMetrics indicates an expected call of QueryTableMetrics.

func (*MockScrapperMockRecorder) QueryTables added in v0.4.7

func (mr *MockScrapperMockRecorder) QueryTables(ctx any, opts ...any) *MockScrapperQueryTablesCall

QueryTables indicates an expected call of QueryTables.

func (*MockScrapperMockRecorder) SqlDialect added in v0.4.7

SqlDialect indicates an expected call of SqlDialect.

func (*MockScrapperMockRecorder) ValidateConfiguration added in v0.4.7

func (mr *MockScrapperMockRecorder) ValidateConfiguration(ctx any) *MockScrapperValidateConfigurationCall

ValidateConfiguration indicates an expected call of ValidateConfiguration.

type MockScrapperQueryCatalogCall added in v0.4.7

type MockScrapperQueryCatalogCall struct {
	*gomock.Call
}

MockScrapperQueryCatalogCall wrap *gomock.Call

func (*MockScrapperQueryCatalogCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperQueryCatalogCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperQueryCatalogCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperQueryCustomMetricsCall added in v0.4.7

type MockScrapperQueryCustomMetricsCall struct {
	*gomock.Call
}

MockScrapperQueryCustomMetricsCall wrap *gomock.Call

func (*MockScrapperQueryCustomMetricsCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperQueryCustomMetricsCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperQueryCustomMetricsCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperQueryDatabasesCall added in v0.4.7

type MockScrapperQueryDatabasesCall struct {
	*gomock.Call
}

MockScrapperQueryDatabasesCall wrap *gomock.Call

func (*MockScrapperQueryDatabasesCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperQueryDatabasesCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperQueryDatabasesCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperQuerySegmentsCall added in v0.4.7

type MockScrapperQuerySegmentsCall struct {
	*gomock.Call
}

MockScrapperQuerySegmentsCall wrap *gomock.Call

func (*MockScrapperQuerySegmentsCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperQuerySegmentsCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperQuerySegmentsCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperQueryShapeCall added in v0.8.3

type MockScrapperQueryShapeCall struct {
	*gomock.Call
}

MockScrapperQueryShapeCall wrap *gomock.Call

func (*MockScrapperQueryShapeCall) Do added in v0.8.3

Do rewrite *gomock.Call.Do

func (*MockScrapperQueryShapeCall) DoAndReturn added in v0.8.3

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperQueryShapeCall) Return added in v0.8.3

Return rewrite *gomock.Call.Return

type MockScrapperQuerySqlDefinitionsCall added in v0.4.7

type MockScrapperQuerySqlDefinitionsCall struct {
	*gomock.Call
}

MockScrapperQuerySqlDefinitionsCall wrap *gomock.Call

func (*MockScrapperQuerySqlDefinitionsCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperQuerySqlDefinitionsCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperQuerySqlDefinitionsCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperQueryTableConstraintsCall added in v0.9.0

type MockScrapperQueryTableConstraintsCall struct {
	*gomock.Call
}

MockScrapperQueryTableConstraintsCall wrap *gomock.Call

func (*MockScrapperQueryTableConstraintsCall) Do added in v0.9.0

Do rewrite *gomock.Call.Do

func (*MockScrapperQueryTableConstraintsCall) DoAndReturn added in v0.9.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperQueryTableConstraintsCall) Return added in v0.9.0

Return rewrite *gomock.Call.Return

type MockScrapperQueryTableMetricsCall added in v0.4.7

type MockScrapperQueryTableMetricsCall struct {
	*gomock.Call
}

MockScrapperQueryTableMetricsCall wrap *gomock.Call

func (*MockScrapperQueryTableMetricsCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperQueryTableMetricsCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperQueryTableMetricsCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperQueryTablesCall added in v0.4.7

type MockScrapperQueryTablesCall struct {
	*gomock.Call
}

MockScrapperQueryTablesCall wrap *gomock.Call

func (*MockScrapperQueryTablesCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperQueryTablesCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperQueryTablesCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperSqlDialectCall added in v0.4.7

type MockScrapperSqlDialectCall struct {
	*gomock.Call
}

MockScrapperSqlDialectCall wrap *gomock.Call

func (*MockScrapperSqlDialectCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperSqlDialectCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperSqlDialectCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type MockScrapperValidateConfigurationCall added in v0.4.7

type MockScrapperValidateConfigurationCall struct {
	*gomock.Call
}

MockScrapperValidateConfigurationCall wrap *gomock.Call

func (*MockScrapperValidateConfigurationCall) Do added in v0.4.7

Do rewrite *gomock.Call.Do

func (*MockScrapperValidateConfigurationCall) DoAndReturn added in v0.4.7

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockScrapperValidateConfigurationCall) Return added in v0.4.7

Return rewrite *gomock.Call.Return

type NoEnoughPermissionsError

type NoEnoughPermissionsError struct {
	Err error
}

func NewNoEnoughPermissionsError

func NewNoEnoughPermissionsError(err error) *NoEnoughPermissionsError

func (*NoEnoughPermissionsError) Error

func (r *NoEnoughPermissionsError) Error() string

type QueryShapeColumn added in v0.8.3

type QueryShapeColumn struct {
	Name       string `json:"name"`
	NativeType string `json:"native_type"`
	Position   int32  `json:"position"`
}

type QueryTablesConfig added in v0.10.6

type QueryTablesConfig struct {
	IncludeConstraints bool
}

QueryTablesConfig holds options for QueryTables.

func ApplyQueryTablesOptions added in v0.10.6

func ApplyQueryTablesOptions(opts ...QueryTablesOption) QueryTablesConfig

ApplyQueryTablesOptions applies the given options to a QueryTablesConfig.

type QueryTablesOption added in v0.10.6

type QueryTablesOption func(*QueryTablesConfig)

QueryTablesOption configures QueryTables behavior.

func WithConstraints added in v0.10.6

func WithConstraints() QueryTablesOption

WithConstraints instructs QueryTables to include table constraints (partitioning, clustering, etc.) in the returned TableRow.Constraints field. This avoids the need for a separate QueryTableConstraints call when the scrapper already fetches the necessary metadata as part of QueryTables.

type SchemaColumnField

type SchemaColumnField struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Human readable name of the column as present in dbt or data warehouse.
	HumanName string `protobuf:"bytes,2,opt,name=human_name,json=humanName,proto3" json:"human_name,omitempty"`
	// Native data type of the column as present in data warehouse.
	NativeType string `protobuf:"bytes,4,opt,name=native_type,json=nativeType,proto3" json:"native_type,omitempty"`
	// Description of the column
	Description *string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
	// Ordinal position of the column in the table, starting from 1
	OrdinalPosition int32 `protobuf:"varint,6,opt,name=ordinal_position,json=ordinalPosition,proto3" json:"ordinal_position,omitempty"`
	// Indicates that the column type could be used as a struct/json in a data warehouse
	IsStruct bool `protobuf:"varint,7,opt,name=is_struct,json=isStruct,proto3" json:"is_struct,omitempty"`
	// Indicates that the column is a repeated field in a data warehouse (e.g. array)
	IsRepeated bool `protobuf:"varint,8,opt,name=is_repeated,json=isRepeated,proto3" json:"is_repeated,omitempty"`
	// Fields inside of the struct/record like column
	Fields []*SchemaColumnField `protobuf:"bytes,9,rep,name=fields,proto3" json:"fields,omitempty"`
}

type Scrapper

type Scrapper interface {
	DialectType() string
	SqlDialect() sqldialect.Dialect
	IsPermissionError(err error) bool
	// Capabilities returns what this scrapper supports beyond the base interface.
	Capabilities() Capabilities
	ValidateConfiguration(ctx context.Context) (warnings []string, err error)
	QueryCatalog(ctx context.Context) ([]*CatalogColumnRow, error)
	QueryTableMetrics(ctx context.Context, lastMetricsFetchTime time.Time) ([]*TableMetricsRow, error)
	QuerySqlDefinitions(ctx context.Context) ([]*SqlDefinitionRow, error)
	QueryTables(ctx context.Context, opts ...QueryTablesOption) ([]*TableRow, error)
	QueryDatabases(ctx context.Context) ([]*DatabaseRow, error)
	QuerySegments(ctx context.Context, sql string, args ...any) ([]*SegmentRow, error)
	QueryCustomMetrics(ctx context.Context, sql string, args ...any) ([]*CustomMetricsRow, error)
	QueryShape(ctx context.Context, sql string) ([]*QueryShapeColumn, error)
	QueryTableConstraints(ctx context.Context) ([]*TableConstraintRow, error)
	// This will close underlying execer, such scrapper can't be used anymore
	Close() error
}

type SegmentRow

type SegmentRow struct {
	Segment string `db:"segment"`
	Count   *int64 `db:"count"`
}

type SegmentValue added in v0.1.7

type SegmentValue struct {
	Name  string
	Value string
}

type SqlDefinitionRow

type SqlDefinitionRow struct {
	Instance           string  `db:"instance"             json:"instance"              ch:"instance"             bigquery:"instance"`
	Database           string  `db:"database"             json:"database"              ch:"_database"            bigquery:"database"`
	Schema             string  `db:"schema"               json:"schema"                ch:"schema"               bigquery:"schema"`
	Table              string  `db:"table"                json:"table"                 ch:"table"                bigquery:"table"`
	IsView             bool    `db:"is_view"              json:"is_view"               ch:"is_view"              bigquery:"is_view"`
	IsTable            bool    `db:"is_table"             json:"is_table"              ch:"is_table"             bigquery:"is_table"`
	IsMaterializedView bool    `db:"is_materialized_view" json:"is_materialized_view"  ch:"is_materialized_view" bigquery:"is_materialized_view"`
	TableType          string  `db:"table_type"           json:"table_type"            ch:"table_type"           bigquery:"table_type"`
	Sql                string  `db:"sql"                  json:"sql"                   ch:"sql"                  bigquery:"sql"`
	Description        *string `                          json:"description,omitempty"`
	Tags               []*Tag  `                          json:"tags,omitempty"`
}

func (SqlDefinitionRow) TableFqn

func (r SqlDefinitionRow) TableFqn() DwhFqn

type TableChangeEvent added in v0.9.2

type TableChangeEvent struct {
	// When the change was committed. Use for time-travel AS OF.
	Timestamp time.Time

	// Database-specific version identifier.
	// Databricks: Delta version number. BigQuery: job_id. Snowflake: empty (hourly bucket).
	Version string

	// Type of operation: "INSERT", "UPDATE", "DELETE", "MERGE", "COPY", "TRUNCATE", "OTHER"
	Operation string

	// Row counts (nil if not available)
	RowsInserted *int64
	RowsUpdated  *int64
	RowsDeleted  *int64
}

TableChangeEvent represents a single modification event on a table.

type TableChangeHistoryProvider added in v0.9.2

type TableChangeHistoryProvider interface {
	FetchTableChangeHistory(
		ctx context.Context,
		fqn DwhFqn,
		from, to time.Time,
		limit int,
	) ([]*TableChangeEvent, error)
}

TableChangeHistoryProvider returns recent modification events for a table, ordered by timestamp descending (most recent first).

Enables constructing time-travel queries:

AT(TIMESTAMP => event.Timestamp - 1s)   -- Snowflake
FOR SYSTEM_TIME AS OF event.Timestamp    -- BigQuery
TIMESTAMP AS OF event.Timestamp          -- Databricks

type TableConstraintRow added in v0.9.0

type TableConstraintRow struct {
	Instance       string `db:"instance"        json:"instance"        ch:"instance"        bigquery:"instance"`
	Database       string `db:"database"        json:"database"        ch:"_database"       bigquery:"database"`
	Schema         string `db:"schema"          json:"schema"          ch:"schema"          bigquery:"schema"`
	Table          string `db:"table"           json:"table"           ch:"table"           bigquery:"table"`
	ConstraintName string `db:"constraint_name" json:"constraint_name" ch:"constraint_name" bigquery:"constraint_name"`
	ColumnName     string `db:"column_name"     json:"column_name"     ch:"column_name"     bigquery:"column_name"`
	ConstraintType string `db:"constraint_type" json:"constraint_type" ch:"constraint_type" bigquery:"constraint_type"`
	ColumnPosition int32  `db:"column_position" json:"column_position" ch:"column_position" bigquery:"column_position"`
}

TableConstraintRow represents a constraint or key on a table column. This covers traditional indexes, primary keys, unique constraints, as well as warehouse-specific concepts like BigQuery partitioning/clustering, ClickHouse sorting keys, and Snowflake clustering keys.

func (TableConstraintRow) TableFqn added in v0.9.0

func (r TableConstraintRow) TableFqn() DwhFqn

type TableMetricsRow

type TableMetricsRow struct {
	Instance  string     `db:"instance"   json:"instance"   ch:"instance"   bigquery:"instance"`
	Database  string     `db:"database"   json:"database"   ch:"_database"  bigquery:"database"`
	Schema    string     `db:"schema"     json:"schema"     ch:"schema"     bigquery:"schema"`
	Table     string     `db:"table"      json:"table"      ch:"table"      bigquery:"table"`
	RowCount  *int64     `db:"row_count"  json:"row_count"  ch:"row_count"  bigquery:"row_count"`
	UpdatedAt *time.Time `db:"updated_at" json:"updated_at" ch:"updated_at" bigquery:"updated_at"`
	SizeBytes *int64     `db:"size_bytes" json:"size_bytes" ch:"size_bytes" bigquery:"size_bytes"`
}

func (TableMetricsRow) TableFqn

func (r TableMetricsRow) TableFqn() DwhFqn

type TableRow

type TableRow struct {
	Instance           string                 `db:"instance"             json:"instance"             ch:"instance"             bigquery:"instance"`
	Database           string                 `db:"database"             json:"database"             ch:"_database"            bigquery:"database"`
	Schema             string                 `db:"schema"               json:"schema"               ch:"schema"               bigquery:"schema"`
	Table              string                 `db:"table"                json:"table"                ch:"table"                bigquery:"table"`
	TableType          string                 `db:"table_type"           json:"table_type"           ch:"table_type"           bigquery:"table_type"`
	Description        *string                `db:"description"          json:"description"          ch:"description"          bigquery:"description"`
	Tags               []*Tag                 `db:"tags"                 json:"tags"`
	IsView             bool                   `db:"is_view"              json:"is_view"              ch:"is_view"`
	IsTable            bool                   `db:"is_table"             json:"is_table"             ch:"is_table"`
	IsMaterializedView bool                   `db:"is_materialized_view" json:"is_materialized_view" ch:"is_materialized_view"`
	Options            map[string]interface{} `db:"options"              json:"options"`
	Annotations        []*Annotation          `db:"annotations"          json:"annotations"`

	// Constraints is optionally populated by QueryTables when WithConstraints() is passed.
	// When non-nil, callers may skip a separate QueryTableConstraints call.
	Constraints []*TableConstraintRow `json:"constraints,omitempty"`
}

func (TableRow) TableFqn

func (r TableRow) TableFqn() DwhFqn

type Tag

type Tag struct {
	// Optionally prefix (`tag.` / `policytag.` / etc)
	TagName  string `json:"tag_name"`
	TagValue string `json:"tag_value"`
}

func (Tag) String

func (t Tag) String() string

type TimeValue

type TimeValue time.Time

type Value

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

type WithSetInstance

type WithSetInstance interface {
	SetInstance(instance string)
}

Directories

Path Synopsis
Package scrappertest provides a compliance test suite that can be embedded in warehouse-specific integration test suites to validate that a scrapper implementation conforms to the expected contract.
Package scrappertest provides a compliance test suite that can be embedded in warehouse-specific integration test suites to validate that a scrapper implementation conforms to the expected contract.

Jump to

Keyboard shortcuts

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