scrapper

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package scrapper is a generated GoMock package.

Index

Constants

This section is empty.

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 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"`
	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) 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) QuerySqlDefinitions added in v0.4.7

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

QuerySqlDefinitions 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) ([]*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 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) 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) QuerySqlDefinitions added in v0.4.7

QuerySqlDefinitions indicates an expected call of QuerySqlDefinitions.

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

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 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 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 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
	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) ([]*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)
	// 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"`
	IsMaterializedView bool   `db:"is_materialized_view" json:"is_materialized_view" ch:"is_materialized_view" bigquery:"is_materialized_view"`
	Sql                string `db:"sql"                  json:"sql"                  ch:"sql"                  bigquery:"sql"`
}

func (SqlDefinitionRow) TableFqn

func (r SqlDefinitionRow) 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"`
	Options     map[string]interface{} `db:"options"     json:"options"`
	Annotations []*Annotation          `db:"annotations" json:"annotations"`
}

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

Jump to

Keyboard shortcuts

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