bigquery

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	IsInitialized(ctxIn context.Context) bool
	ExtractTableToGcsAsAvro(ctxIn context.Context, dataset, table, gcsURI string) *bq.Extractor
	GetExtractJobStatus(ctxIn context.Context, extractJobID string) (*bq.JobStatus, error)
	DoesDatasetExists(ctxIn context.Context, project string, dataset string) (bool, error)
	GetTable(ctxIn context.Context, project string, dataset string, table string) (*Table, error)
	GetTablesInDataset(ctxIn context.Context, project string, dataset string) ([]*Table, error)
	HasTablePartitions(ctxIn context.Context, project string, dataset string, table string) (bool, error)
	GetTablePartitions(ctxIn context.Context, project string, dataset string, table string) ([]*Table, error)
	GetDatasets(ctxIn context.Context, project string) ([]string, error)
	DeleteExtractJob(ctxIn context.Context, extractJobID string, location string) error
	GetDatasetDetails(ctxIn context.Context, datasetId string) (*bq.DatasetMetadata, error)
}

Client define operations for BigQuery

func NewBigQueryClient

func NewBigQueryClient(ctxIn context.Context, targetPrincipalProvider impersonate.TargetPrincipalForProjectProvider, sourceProjectID string, targetProjectID string) (Client, error)

NewBigQueryClient crete new instance of defaultBigQueryClient

type ExtractJobHandler

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

ExtractJobHandler represent exporting data from BigQuery

func NewExtractJobHandler

func NewExtractJobHandler(ctxIn context.Context, tokenSourceProvider impersonate.TargetPrincipalForProjectProvider, srcProjectID, targetProjectID string) (*ExtractJobHandler, error)

NewExtractJobHandler create new instance of ExtractJobHandler

func (*ExtractJobHandler) CreateAvroJob

func (e *ExtractJobHandler) CreateAvroJob(ctxIn context.Context, dataset, table, sinkURI string) (string, error)

CreateAvroJob start a BigQuery job that export data in AVRO format

func (*ExtractJobHandler) DeleteExtractJob added in v1.3.4

func (e *ExtractJobHandler) DeleteExtractJob(ctx context.Context, jobID string, location string) error

DeleteExtractJob delete a BigQuery job If job does not exist, it returns nil

func (*ExtractJobHandler) GetStatusOfJob

func (e *ExtractJobHandler) GetStatusOfJob(ctxIn context.Context, extractJobID string) (ExtractJobState, error)

GetStatusOfJob get actuall status for a BigQuery job

type ExtractJobState

type ExtractJobState int

ExtractJobState State is one of a sequence of states that a Job progresses through as it is processed.

const (
	// StateUnspecified is the default JobIterator state.
	StateUnspecified ExtractJobState = iota
	// Pending is a state that describes that the job is pending.
	Pending
	// Running is a state that describes that the job is running.
	Running
	// Done is a state that describes that the job is done.
	Done
	// Failed is a state that describes that the job complete unsuccessfully.
	Failed
	// FailedQuotaExceeded for project exceeded 11 TB
	FailedQuotaExceeded
)

func (ExtractJobState) String

func (s ExtractJobState) String() string

type Table

type Table struct {
	Name             string
	Checksum         string
	SizeInBytes      float64
	LastModifiedTime time.Time
}

Table store information for BigQuery table changes

Jump to

Keyboard shortcuts

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