Skip to main content

bigquery@1.1.0

Adaptor

Adaptor.execute(operations) ⇒ Operation

Execute a sequence of operations. Wraps language-common/execute, and prepends initial state for http.

Kind: static method of Adaptor

ParamTypeDescription
operationsOperationsOperations to be performed.

Example

execute(
create('foo'),
delete('bar')
)(state)

Adaptor.load(dirPath, projectId, datasetId, tableId, loadOptions, callback) ⇒ Operation

Load files to BigQuery

Kind: static method of Adaptor
Access: public

ParamTypeDescription
dirPathstringthe path to your local directory
projectIdstringyour bigquery project id
datasetIdstringyour bigquery dataset id
tableIdstringthe name of the table you'd like to load
loadOptionsobjectoptions to pass to the bigquery.load() API
callbackfunctionand optional callback

Example

load(
'./tmp/files',
'my-bg-project',
'test01',
'product-codes',
{
schema: 'FREQ:STRING,DATATYPE:STRING,PRODUCTCODE:STRING,PARTNER:STRING',
writeDisposition: 'WRITE_APPEND',
skipLeadingRows: 1,
schemaUpdateOptions: ['ALLOW_FIELD_ADDITION'],
createDisposition: 'CREATE_IF_NEEDED',
}
)

Adaptor.parseCSV(target, config) ⇒ Operation

CSV-Parse for CSV conversion to JSON

Kind: static method of Adaptor
Access: public

ParamTypeDescription
targetStringstring or local file with CSV data
configObjectcsv-parse config object

Example

parseCSV("/home/user/someData.csv", {
quoteChar: '"',
header: false,
});