databricks

package
v0.16.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScopeFromConf added in v0.10.0

func ScopeFromConf(conf *DatabricksScrapperConf) *scope.ScopeFilter

ScopeFromConf resolves the scope the config asks for.

Scope is what callers should set. CatalogBlocklist is the older, narrower way of saying the same thing — comma-separated catalog patterns, exclusions only — and is read only when Scope is unset, so a caller that has migrated is never also subject to a stale blocklist. A Scope that is present but carries no rules therefore means "no filtering", not "fall back to the blocklist".

Returns nil when neither is configured, which every ScopeFilter method treats as accepting everything.

Types

type DatabricksScrapper

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

func NewDatabricksScrapper

func NewDatabricksScrapper(ctx context.Context, conf *DatabricksScrapperConf) (*DatabricksScrapper, error)

func (*DatabricksScrapper) Capabilities added in v0.10.6

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

func (*DatabricksScrapper) Close

func (e *DatabricksScrapper) Close() error

func (*DatabricksScrapper) DialectType added in v0.1.8

func (e *DatabricksScrapper) DialectType() string

func (*DatabricksScrapper) EstimateQuery added in v0.16.0

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

EstimateQuery is unsupported for now. Databricks/Spark EXPLAIN output is a cost-based-optimizer plan whose byte/row estimates require CBO statistics (ANALYZE TABLE ... COMPUTE STATISTICS) that are frequently absent, and the plan text format is not stable enough to parse reliably. Returning ErrUnsupported until a validation spike confirms a trustworthy estimate.

func (*DatabricksScrapper) Executor

func (*DatabricksScrapper) FetchQueryLogs added in v0.5.0

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

func (*DatabricksScrapper) FetchTableChangeHistory added in v0.9.2

func (e *DatabricksScrapper) FetchTableChangeHistory(
	ctx context.Context,
	fqn scrapper.DwhFqn,
	from, to time.Time,
	limit int,
) ([]*scrapper.TableChangeEvent, error)

func (*DatabricksScrapper) GetApiClient

func (e *DatabricksScrapper) GetApiClient() *databricks.WorkspaceClient

func (*DatabricksScrapper) IsPermissionError added in v0.1.1

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

func (*DatabricksScrapper) QueryCatalog

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

func (*DatabricksScrapper) QueryCustomMetrics

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

func (*DatabricksScrapper) QueryDatabases

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

func (*DatabricksScrapper) QuerySchemas added in v0.14.5

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

func (*DatabricksScrapper) QuerySegments

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

func (*DatabricksScrapper) QueryShape added in v0.8.3

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

func (*DatabricksScrapper) QuerySqlDefinitions

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

func (*DatabricksScrapper) QueryTableConstraints added in v0.9.0

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

func (*DatabricksScrapper) QueryTableMetrics

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

func (*DatabricksScrapper) QueryTables

func (*DatabricksScrapper) RunRawQuery added in v0.13.7

func (*DatabricksScrapper) SqlDialect added in v0.1.8

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

func (*DatabricksScrapper) ValidateConfiguration

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

type DatabricksScrapperConf

type DatabricksScrapperConf struct {
	dwhexecdatabricks.DatabricksConf
	// Scope limits every walk of Unity Catalog to the catalogs, schemas and tables it
	// accepts. It supersedes CatalogBlocklist, which can express nothing but
	// catalog-level exclusions.
	Scope *scope.ScopeFilter
	// CatalogBlocklist is a comma-separated list of catalog name patterns to exclude.
	//
	// Deprecated: use Scope, which covers schemas and tables as well. Still honoured
	// for callers that have not migrated, but only when Scope is unset — a Scope that
	// is present, even one carrying no rules, is what takes effect. This matches how
	// the cloud-side accounts.v1.Databricks.catalog_blocklist field it is fed from is
	// superseded by dwh_fetch_config.catalog.scope_filter.
	CatalogBlocklist           string
	FetchQueryLogs             bool
	RefreshTableMetrics        bool
	RefreshTableMetricsUseScan bool
	FetchTableTags             bool
	UseShowCreateTable         bool
	// QueryLogsStartTimeBuffer is the time buffer to add before the 'from' timestamp when fetching query logs.
	// This is needed because Databricks API filters by query start time, but we want queries that finished
	// in the target time range. A query that started before 'from' might finish after 'from'.
	// Default: 2 hours. Set to 0 to disable the buffer (use exact 'from' time).
	QueryLogsStartTimeBuffer *time.Duration
}

type Executor

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

type Tags

type Tags struct {
	CatalogName string `db:"catalog_name" json:"catalog_name"`
	SchemaName  string `db:"schema_name"  json:"schema_name"`
	TableName   string `db:"table_name"   json:"table_name"`
	ColumnName  string `db:"column_name"  json:"column_name"`
	TagName     string `db:"tag_name"     json:"tag_name"`
	TagValue    string `db:"tag_value"    json:"tag_value"`
}

Jump to

Keyboard shortcuts

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