client

package
v0.0.0-...-231df35 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2018 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowLargeResults

func AllowLargeResults(shouldAllow bool, tempTableName string, flattenResults bool) func(*Client) error

AllowLargeResults is a configuration function that can be used to enable the AllowLargeResults setting of a bigquery request, as well as a temp table name to use to build the result data

An example use is:

client.New(pemPath, serviceAccountEmailAddress, serviceUserAccountClientID, clientSecret, client.AllowLargeResults(true, "tempTableName"))

Types

type Client

type Client struct {
	PrintDebug     bool
	RequestTimeout int64 // how long (in milliseconds) to try to create requests for large data (not a query timeout); defaults to 60000
	// contains filtered or unexported fields
}

Client a big query client instance

func New

func New(pemPath string, options ...func(*Client) error) *Client

New instantiates a new client with the given params and return a reference to it

func (*Client) AsyncQuery

func (c *Client) AsyncQuery(pageSize int, dataset, project, queryStr string, dataChan chan Data)

AsyncQuery loads the data by paging through the query results and sends back payloads over the dataChan - dataChan sends a payload containing Data objects made up of the headers, rows and an error attribute

func (*Client) Count

func (c *Client) Count(dataset, project, datasetTable string) int64

Count loads the row count for the provided dataset.tablename

func (*Client) InsertNewTable

func (c *Client) InsertNewTable(projectID, datasetID, tableName string, fields map[string]string) error

InsertNewTable creates a new empty table for the given project and dataset with the field name/types defined in the fields map

func (*Client) InsertNewTableIfDoesNotExist

func (c *Client) InsertNewTableIfDoesNotExist(projectID, datasetID, tableID string, fields map[string]string) error

func (*Client) InsertRow

func (c *Client) InsertRow(projectID, datasetID, tableID string, rowData map[string]interface{}) error

InsertRow inserts a new row into the desired project, dataset and table or returns an error

func (*Client) InsertRows

func (c *Client) InsertRows(projectID, datasetID, tableID string, rows []map[string]interface{}) error

func (*Client) PatchTableSchema

func (c *Client) PatchTableSchema(projectID, datasetID, tableID string, fields map[string]string) error

PatchTableSchema sends a patch request to bigquery to modify the table with only the fields provided

func (*Client) Query

func (c *Client) Query(dataset, project, queryStr string) ([][]interface{}, []string, error)

Query loads the data for the query paging if necessary and return the data rows, headers and error

func (*Client) SyncQuery

func (c *Client) SyncQuery(dataset, project, queryStr string, maxResults int64) ([][]interface{}, error)

SyncQuery executes an arbitrary query string and returns the result synchronously (unless the response takes longer than the provided timeout)

type Data

type Data struct {
	Headers []string
	Rows    [][]interface{}
	Err     error
}

Data is a containing type used for Async data response handling including Headers, Rows and an Error that will be populated in the event of an Error querying

Jump to

Keyboard shortcuts

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