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 DateAddInterval(datepart, n, start string) string
- func DateAddQuoted(datepart, n, start string) string
- func DeduplicateArrayAgg(relation, partitionBy, orderBy string) string
- func DeduplicateDistinctOn(relation, partitionBy, orderBy string) string
- func DeduplicateNaturalJoinNoAs(relation, partitionBy, orderBy string) string
- func DeduplicateQualify(relation, partitionBy, orderBy string) string
- func DeduplicateSubquery(relation, partitionBy, orderBy string) string
- func GetColumnsWithMergeLogic(asset *pipeline.Asset) []pipeline.Column
- func HashBytesHashFn(expr string) string
- 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 DateAddInterval ¶ added in v0.11.598
DateAddInterval generates DATE_ADD(start, INTERVAL n datepart) syntax used by BigQuery and MySQL.
func DateAddQuoted ¶ added in v0.11.598
DateAddQuoted generates date_add('datepart', n, start) syntax used by Athena and Trino.
func DeduplicateArrayAgg ¶ added in v0.11.598
DeduplicateArrayAgg generates a deduplication query using ordered array aggregation. Supported by Trino and Athena, where QUALIFY/NATURAL JOIN are unavailable.
func DeduplicateDistinctOn ¶ added in v0.11.598
DeduplicateDistinctOn generates a deduplication query using DISTINCT ON. Supported by Postgres.
func DeduplicateNaturalJoinNoAs ¶ added in v0.11.598
DeduplicateNaturalJoinNoAs generates the fallback natural-join deduplication shape without AS table aliases. This is useful for dialects like Oracle that do not support AS for table aliases.
func DeduplicateQualify ¶ added in v0.11.598
DeduplicateQualify generates a deduplication query using the QUALIFY clause. Supported by Snowflake, BigQuery, Databricks, Redshift, and DuckDB.
func DeduplicateSubquery ¶ added in v0.11.598
DeduplicateSubquery generates a deduplication query using TOP WITH TIES. For platforms without QUALIFY or DISTINCT ON support (MSSQL, Synapse, Fabric). The output contains only the original relation columns (no internal helper columns).
func GetColumnsWithMergeLogic ¶ added in v0.11.325
func HashBytesHashFn ¶ added in v0.11.598
HashBytesHashFn returns a MSSQL-family HASHBYTES hash expression for use with SurrogateKeyWith.
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