bigquery

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 31 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

View Source
var BaseExpectedPermissions = []string{
	"bigquery.datasets.get",
	"bigquery.datasets.getIamPolicy",
	"bigquery.jobs.create",
	"bigquery.jobs.get",
	"bigquery.jobs.list",
	"bigquery.jobs.listAll",
	"bigquery.routines.get",
	"bigquery.routines.list",
	"bigquery.tables.get",
	"bigquery.tables.getData",
	"bigquery.tables.list",
	"resourcemanager.projects.get",
}

Functions

func QueryAndProcessMany

func QueryAndProcessMany[T any](
	ctx context.Context,
	conn Executor,
	sql string,
	handler func(ctx context.Context, rows []*T) error,
	opts ...dwhexec.QueryManyOpt[T],
) error

func QueryMany

func QueryMany[T any](ctx context.Context, conn Executor, sql string, opts ...dwhexec.QueryManyOpt[T]) ([]*T, error)

func ScopeFromConf added in v0.10.0

func ScopeFromConf(conf *BigQueryScrapperConf) *scope.ScopeFilter

ScopeFromConf translates the BigQuery config's Blocklist field into a ScopeFilter. Blocklist patterns are comma-separated dataset (schema) patterns. Returns nil if no filtering is configured.

Types

type BigQueryQueryLogSchema added in v0.5.0

type BigQueryQueryLogSchema struct {
	CreationTime        time.Time           `bigquery:"creation_time"`
	ProjectId           bigquery.NullString `bigquery:"project_id"`
	ProjectNumber       bigquery.NullInt64  `bigquery:"project_number"`
	UserEmail           bigquery.NullString `bigquery:"user_email"`
	JobId               bigquery.NullString `bigquery:"job_id"`
	JobType             bigquery.NullString `bigquery:"job_type"`
	StatementType       bigquery.NullString `bigquery:"statement_type"`
	Priority            bigquery.NullString `bigquery:"priority"`
	StartTime           time.Time           `bigquery:"start_time"`
	EndTime             time.Time           `bigquery:"end_time"`
	Query               bigquery.NullString `bigquery:"query"`
	State               bigquery.NullString `bigquery:"state"`
	ReservationId       bigquery.NullString `bigquery:"reservation_id"`
	TotalBytesProcessed bigquery.NullInt64  `bigquery:"total_bytes_processed"`
	TotalSlotMs         bigquery.NullInt64  `bigquery:"total_slot_ms"`
	ErrorResult         *struct {
		Reason  bigquery.NullString `bigquery:"reason"`
		Message bigquery.NullString `bigquery:"message"`
	} `bigquery:"error_result"`
	CacheHit         bigquery.NullBool `bigquery:"cache_hit"`
	DestinationTable *BqQueryTable     `bigquery:"destination_table"`
	ReferencedTables []*BqQueryTable   `bigquery:"referenced_tables"`
	Labels           []*struct {
		Key   bigquery.NullString `bigquery:"key"`
		Value bigquery.NullString `bigquery:"value"`
	} `bigquery:"labels"`
	JobStages []*struct {
		Name           bigquery.NullString `bigquery:"name"`
		RecordsRead    bigquery.NullInt64  `bigquery:"records_read"`
		RecordsWritten bigquery.NullInt64  `bigquery:"records_written"`
		Status         bigquery.NullString `bigquery:"status"`
	} `bigquery:"job_stages"`
	TotalBytesBilled bigquery.NullInt64  `bigquery:"total_bytes_billed"`
	TransactionId    bigquery.NullString `bigquery:"transaction_id"`
	ParentJobId      bigquery.NullString `bigquery:"parent_job_id"`
	TransferredBytes bigquery.NullInt64  `bigquery:"transferred_bytes"`
}

type BigQueryScrapper

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

func NewBigQueryScrapper

func NewBigQueryScrapper(ctx context.Context, conf *BigQueryScrapperConf) (*BigQueryScrapper, error)

func (*BigQueryScrapper) Close

func (e *BigQueryScrapper) Close() error

func (*BigQueryScrapper) DialectType added in v0.1.8

func (e *BigQueryScrapper) DialectType() string

func (*BigQueryScrapper) Executor

func (*BigQueryScrapper) FetchQueryLogs added in v0.5.0

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

func (*BigQueryScrapper) FetchTableChangeHistory added in v0.9.2

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

func (*BigQueryScrapper) IsPermissionError added in v0.1.1

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

func (*BigQueryScrapper) QueryCatalog

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

func (*BigQueryScrapper) QueryCustomMetrics

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

func (*BigQueryScrapper) QueryDatabases

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

func (*BigQueryScrapper) QuerySegments

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

func (*BigQueryScrapper) QueryShape added in v0.8.3

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

func (*BigQueryScrapper) QuerySqlDefinitions

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

func (*BigQueryScrapper) QueryTableConstraints added in v0.9.0

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

func (*BigQueryScrapper) QueryTableMetrics

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

func (*BigQueryScrapper) QueryTables

func (e *BigQueryScrapper) QueryTables(ctx context.Context) ([]*scrapper.TableRow, error)

func (*BigQueryScrapper) SqlDialect added in v0.1.8

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

func (*BigQueryScrapper) ValidateConfiguration

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

type BigQueryScrapperConf

type BigQueryScrapperConf struct {
	dwhexecbigquery.BigQueryConf
	Blocklist string
}

type BqQueryTable added in v0.5.0

type BqQueryTable struct {
	ProjectId bigquery.NullString `bigquery:"project_id"`
	DatasetId bigquery.NullString `bigquery:"dataset_id"`
	TableId   bigquery.NullString `bigquery:"table_id"`
}

type Executor

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

type ShardedTable

type ShardedTable struct {
	TableName     string
	Shards        []time.Time
	LatestShardId string
}

Jump to

Keyboard shortcuts

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