Documentation
¶
Index ¶
- Constants
- func AddAnnotationComment(ctx context.Context, q *query.Query, assetName, taskType, pipelineName string) (*query.Query, error)
- func AddColumnCheckAnnotationComment(ctx context.Context, q *query.Query, ...) (*query.Query, error)
- func AddCustomCheckAnnotationComment(ctx context.Context, q *query.Query, assetName, checkName, pipelineName string) (*query.Query, error)
- func BuildAdhocQueryTag(annotations string) (string, error)
- func BuildAnnotationJSON(ctx context.Context, fields map[string]interface{}) (string, error)
- func BuildTruncateInsertQuery(task *pipeline.Asset, query string) (string, error)
- func GetColumnsWithMergeLogic(asset *pipeline.Asset) []pipeline.Column
- func LogQueryIfVerbose(ctx context.Context, writer interface{}, queryString string)
- type CheckError
- type CheckRunner
- type ColumnCheckOperator
- type CountableQueryCheck
- type CustomCheck
- type CustomCheckOperator
- type CustomCheckRunner
- type DBColumn
- type DBColumnType
- type DBDatabase
- type DBSchema
- type DBTable
- type DBTableType
- type MaxCheck
- type MinCheck
- type NegativeCheck
- type NonNegativeCheck
- type NotNullCheck
- type PositiveCheck
- type QuerySensor
- type SchemaCreator
- type TableExistsChecker
- type TableSensor
- type TableSummaryResult
- type UniqueCheck
Constants ¶
const ( DefaultQueryAnnotations = "default" QueryLogCharacterLimit = 10000 )
Variables ¶
This section is empty.
Functions ¶
func AddAnnotationComment ¶ added in v0.11.293
func AddColumnCheckAnnotationComment ¶ added in v0.11.296
func AddCustomCheckAnnotationComment ¶ added in v0.11.296
func BuildAdhocQueryTag ¶ added in v0.11.574
BuildAdhocQueryTag builds the JSON annotation payload for an adhoc query (e.g. `bruin query`). When annotations is empty, the baseline annotation is still emitted so every adhoc query is tagged.
func BuildAnnotationJSON ¶ added in v0.11.522
BuildAnnotationJSON builds the annotation JSON string by merging standard fields with any user-provided annotations from the context. Returns empty string if annotations are not enabled.
func BuildTruncateInsertQuery ¶ added in v0.11.298
BuildTruncateInsertQuery creates a truncate+insert query that works for standard ANSI SQL databases. This can be used by platforms that support standard TRUNCATE TABLE syntax with transactions.
func GetColumnsWithMergeLogic ¶ added in v0.11.325
func LogQueryIfVerbose ¶ added in v0.11.326
LogQueryIfVerbose logs the SQL query to the writer if verbose mode is enabled. It checks for the verbose flag in the context and writes a formatted query preview to the printer writer, truncating queries longer than QueryLogCharacterLimit.
Types ¶
type CheckError ¶ added in v0.11.389
CheckError is a custom error type that carries query and result information for better error reporting when running single checks.
func (*CheckError) Error ¶ added in v0.11.389
func (e *CheckError) Error() string
type CheckRunner ¶
type CheckRunner interface {
Check(ctx context.Context, ti *scheduler.ColumnCheckInstance) error
}
type ColumnCheckOperator ¶
type ColumnCheckOperator struct {
// contains filtered or unexported fields
}
func NewColumnCheckOperator ¶
func NewColumnCheckOperator(checks map[string]CheckRunner) *ColumnCheckOperator
func (ColumnCheckOperator) Run ¶
func (o ColumnCheckOperator) Run(ctx context.Context, ti scheduler.TaskInstance) error
type CountableQueryCheck ¶
type CountableQueryCheck struct {
// contains filtered or unexported fields
}
func NewCountableQueryCheck ¶
func NewCountableQueryCheck(conn config.ConnectionGetter, expectedQueryResult int64, queryInstance *query.Query, checkName string, customError func(count int64) error) *CountableQueryCheck
func (*CountableQueryCheck) Check ¶
func (c *CountableQueryCheck) Check(ctx context.Context, ti *scheduler.ColumnCheckInstance) error
func (*CountableQueryCheck) CustomCheck ¶
func (c *CountableQueryCheck) CustomCheck(ctx context.Context, ti *scheduler.CustomCheckInstance) error
type CustomCheck ¶
type CustomCheck struct {
// contains filtered or unexported fields
}
func NewCustomCheck ¶
func NewCustomCheck(conn config.ConnectionGetter, renderer jinja.RendererInterface) *CustomCheck
func (*CustomCheck) Check ¶
func (c *CustomCheck) Check(ctx context.Context, ti *scheduler.CustomCheckInstance) error
type CustomCheckOperator ¶
type CustomCheckOperator struct {
// contains filtered or unexported fields
}
func NewCustomCheckOperator ¶
func NewCustomCheckOperator(manager config.ConnectionGetter, r jinja.RendererInterface) *CustomCheckOperator
func (*CustomCheckOperator) Run ¶
func (o *CustomCheckOperator) Run(ctx context.Context, ti scheduler.TaskInstance) error
type CustomCheckRunner ¶
type CustomCheckRunner interface {
Check(ctx context.Context, ti *scheduler.CustomCheckInstance) error
}
type DBColumnType ¶ added in v0.11.172
type DBDatabase ¶ added in v0.11.172
func (*DBDatabase) TableExists ¶ added in v0.11.172
func (d *DBDatabase) TableExists(schema, table string) bool
type DBTable ¶ added in v0.11.172
type DBTable struct {
Name string `json:"name"`
Type DBTableType `json:"type,omitempty"` // "table" or "view"
ViewDefinition string `json:"view_definition,omitempty"` // SQL definition for views
Columns []*DBColumn `json:"columns"`
// Metadata fields for import description enrichment
CreatedAt *time.Time `json:"created_at,omitempty"` // When the table was created
LastModified *time.Time `json:"last_modified,omitempty"` // When the table was last modified
RowCount *int64 `json:"row_count,omitempty"` // Number of rows in the table
SizeBytes *int64 `json:"size_bytes,omitempty"` // Size of the table in bytes
Description string `json:"description,omitempty"` // Description from the database
Owner string `json:"owner,omitempty"` // Owner of the table
TableComment string `json:"table_comment,omitempty"` // Comment/description on the table
}
type DBTableType ¶ added in v0.11.430
type DBTableType string
DBTableType represents the type of a database table.
const ( // DBTableTypeTable represents a regular table. DBTableTypeTable DBTableType = "table" // DBTableTypeView represents a view. DBTableTypeView DBTableType = "view" )
type MaxCheck ¶ added in v0.11.280
type MaxCheck struct {
// contains filtered or unexported fields
}
func NewMaxCheck ¶ added in v0.11.280
func NewMaxCheck(conn config.ConnectionGetter) *MaxCheck
type MinCheck ¶ added in v0.11.280
type MinCheck struct {
// contains filtered or unexported fields
}
func NewMinCheck ¶ added in v0.11.280
func NewMinCheck(conn config.ConnectionGetter) *MinCheck
type NegativeCheck ¶ added in v0.10.1
type NegativeCheck struct {
// contains filtered or unexported fields
}
func NewNegativeCheck ¶ added in v0.10.1
func NewNegativeCheck(conn config.ConnectionGetter) *NegativeCheck
func (*NegativeCheck) Check ¶ added in v0.10.1
func (c *NegativeCheck) Check(ctx context.Context, ti *scheduler.ColumnCheckInstance) error
type NonNegativeCheck ¶
type NonNegativeCheck struct {
// contains filtered or unexported fields
}
func NewNonNegativeCheck ¶
func NewNonNegativeCheck(conn config.ConnectionGetter) *NonNegativeCheck
func (*NonNegativeCheck) Check ¶
func (c *NonNegativeCheck) Check(ctx context.Context, ti *scheduler.ColumnCheckInstance) error
type NotNullCheck ¶
type NotNullCheck struct {
// contains filtered or unexported fields
}
func NewNotNullCheck ¶
func NewNotNullCheck(conn config.ConnectionGetter) *NotNullCheck
func (*NotNullCheck) Check ¶
func (c *NotNullCheck) Check(ctx context.Context, ti *scheduler.ColumnCheckInstance) error
type PositiveCheck ¶
type PositiveCheck struct {
// contains filtered or unexported fields
}
func NewPositiveCheck ¶
func NewPositiveCheck(conn config.ConnectionGetter) *PositiveCheck
func (*PositiveCheck) Check ¶
func (c *PositiveCheck) Check(ctx context.Context, ti *scheduler.ColumnCheckInstance) error
type QuerySensor ¶ added in v0.11.222
type QuerySensor struct {
// contains filtered or unexported fields
}
func NewQuerySensor ¶ added in v0.11.222
func NewQuerySensor(conn config.ConnectionGetter, extractor query.QueryExtractor, sensorMode string) *QuerySensor
func (*QuerySensor) Run ¶ added in v0.11.222
func (o *QuerySensor) Run(ctx context.Context, ti scheduler.TaskInstance) error
type SchemaCreator ¶ added in v0.11.175
type SchemaCreator struct {
// contains filtered or unexported fields
}
func NewSchemaCreator ¶ added in v0.11.175
func NewSchemaCreator() *SchemaCreator
func (*SchemaCreator) CreateSchemaIfNotExist ¶ added in v0.11.175
type TableExistsChecker ¶ added in v0.11.286
type TableSensor ¶ added in v0.11.286
type TableSensor struct {
// contains filtered or unexported fields
}
func NewTableSensor ¶ added in v0.11.286
func NewTableSensor(conn config.ConnectionGetter, sensorMode string, extractor query.QueryExtractor) *TableSensor
func NewTableSensorWithDependencies ¶ added in v0.11.286
func NewTableSensorWithDependencies( conn config.ConnectionGetter, sensorMode string, extractor query.QueryExtractor, ) *TableSensor
func (*TableSensor) Run ¶ added in v0.11.286
func (ts *TableSensor) Run(ctx context.Context, ti scheduler.TaskInstance) error
type TableSummaryResult ¶ added in v0.11.224
func (*TableSummaryResult) String ¶ added in v0.11.224
func (tsr *TableSummaryResult) String() string
type UniqueCheck ¶
type UniqueCheck struct {
// contains filtered or unexported fields
}
func NewUniqueCheck ¶
func NewUniqueCheck(conn config.ConnectionGetter) *UniqueCheck
func (*UniqueCheck) Check ¶
func (c *UniqueCheck) Check(ctx context.Context, ti *scheduler.ColumnCheckInstance) error