@emartech/google-big-query

4.0.1 • Public • Published

@emartech/google-big-query

Helper library to easily use Google BigQuery in NodeJS

Configuration

@emartech/google-big-query uses the config package for configuration. You should make the following settings available under `"GoogleCloud" namespace:

{
  "projectId": "",
  "bucket": "",
  "dataset": "",
  "credentials": {},
  "maximumBillingTier": 10
}

projectId

The project you'll use for billing.

dataset

The default dataset to connect to if it was not specified.

credentials

The credentials the connection will use.

Example:

{
  "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
  "client_email": "example@my-service.iam.gserviceaccount.com"
}

maximumBillingTier

More info about pricing: https://cloud.google.com/bigquery/pricing

API

const BigQuery = require('@emartech/google-big-query');

BigQuery

Methods

create(datasetName):BigQuery static

Creates a BigQuery instance.

Parameters
Name Type Description
datasetName string The name of the default dataset.
Default: config.GoogleCloud.dataset
optional
Returns
Type Description
BigQuery Instance of the BigQuery wrapper class.

constructor(datasetName, client):BigQuery

Constructor of BigQuery wrapper.

Parameters
Name Type Description
datasetName string The name of the default dataset.
client @google-cloud/bigquery The BigQuery client.

table(tableName):Table

Returns a Table instance for the given table name.

Parameters
Name Type Description
tableName string The name of the table in the dataset
Returns
Type Description
Table Google Cloud BigQuery Table class instance.

createQueryStream(query):ReadableStream

This is a wrapper of the original createQueryStream() method.

Parameters
Name Type Description
query string or object The query to run.
More info about the parameter.
Returns
Type Description
ReadableStream

query(query):Promise

This is a wrapper of the original query() method.

Parameters
Name Type Description
query string or object The query to run.
More info about the parameter.
Returns
Type Description
Promise

createQueryJob(query):Promise generator

This is a wrapper of the original createQueryJob() method.

Parameters
Name Type Description
options object or string
Returns
Type Description
Promise
Example
let [job] = yield BigQuery.create().createQueryJob(query);
job.getQueryResultsStream({ maxResults: 100000, startIndex: 0 }).pipe(processRow);

createTableIfNotExists(table, schema):Table generator

Creates the table with the specified schema.

Parameters
Name Type Description
table Table The table instance
schema object Schema definition of the table
Returns
Type Description
Table The new Table.

dropTableIfExists(table):void generator

Drops the given table if exists.

Parameters
Name Type Description
table Table The table instance that should be dropped.

createTable(tableName, options):Table generator

This is a wrapper of the original createTable() method.

Parameters
Name Type Description
tableName string The name of the table.
options object More info in the original documentation. optional
Returns
Type Description
Table The new Table.

BigQuery.FileToTable

create(file, tableName, schema, options):FileToTable static

createWith(file, table, schema, options):FileToTable static

constructor(file, table, schema options):FileToTable

run():Job

BigQuery.QueryToFile

create(baseName, format, file):QueryToFile static

constructor(tableName, format, file):QueryToFile

run(query, options):File generator

BigQuery.QueryToFileToStream

create(baseName):QueryToFileToStream static

constructor(queryToFile):QueryToFileToStream

createQueryStream(query, options):JSONStream generator

BigQuery.QueryToStream

create():QueryToStream static

constructor(client):QueryToStream

run(query, parameters):ReadableStream

BigQuery.QueryToTable

create(tableName, dataset):QueryToTable static

constructor(client, tableName, dataset):QueryToTable

run(query, params):Job generator

BigQuery.QueryToView

create(viewName):QueryToView static

constructor(client, viewName):QueryToView

run():Table generator

BigQuery.StreamToTable

create(tableName, tableSchema):StreamToTable static

constructor(table, tableSchema):StreamToTable

saveStream():Promise

BigQuery.TableToFile

create(tableName, file, format):TableToFile static

constructor(table, file, format):TableToFile

run():Job generator

Readme

Keywords

none

Package Sidebar

Install

npm i @emartech/google-big-query

Weekly Downloads

13

Version

4.0.1

License

MIT

Unpacked Size

21.4 kB

Total Files

16

Last publish

Collaborators

  • fhase
  • alanshi
  • jisaacson
  • i850773
  • csjakabos
  • borcsa
  • bcsizmadia
  • schroedersteffen
  • sfariel
  • botondjavorka
  • i534456
  • daniel.balazs
  • tade82
  • probalazs
  • luca.fasolino.se
  • rmafteiuscai
  • lhammerl
  • bencso
  • mfel0123
  • franziskajung
  • d056437
  • ekkovats
  • laralangnau
  • emarsys-stephen-ives
  • tothbence8
  • earlpitts
  • iabraham
  • zholler
  • balintkemenyemarsys
  • ccarrollem
  • dunaicapa
  • bobby_russel
  • sovagos
  • tothmarci25
  • mariannag
  • estefanlesnjakovic
  • mrmeszaros
  • bence.toth
  • jason-nelson-01
  • drahos.istvan
  • pecc
  • birokhun
  • laszlo.ori
  • dpkemarsys
  • nathan-matthews-sap
  • troywiegand
  • nikolett.tar
  • bronika
  • cenglersap
  • mlesh-sap
  • gillyes
  • danielisap
  • sridevir
  • abieler-sap
  • aidanlesh-sap
  • tonyhsap
  • karlabrandl
  • konradschewe
  • manasbommakanti
  • dudaaslaci
  • emarsys-security
  • norbert-levajsics-emarsys
  • ronnykrosse
  • vszegedi
  • sap-am
  • nnieman-sap
  • ariceem
  • dwolter_emarsys
  • rcsullag
  • ttoth2
  • tbucsanszki
  • dszunomar
  • dschuppa
  • andras.sarro
  • ndomke
  • sevket-ataseven
  • plsap
  • mattfeldhake_emarsys
  • atittel
  • andrasp3a
  • mruell
  • adroszler
  • erikpetroemar
  • rimo86
  • tillmannr
  • markjarvis
  • geczirobert
  • tsiraitnpm
  • bankyadam
  • bborsi
  • zbalazs
  • ziyadg
  • pintera
  • apoon
  • ianhelmrich
  • varszegik
  • rkumari03
  • cseby92
  • bozsadam
  • jfillmore
  • viktor.szell
  • bencekadaremar
  • roxanams
  • dkocsis-emarsys
  • demajo_ems
  • marko.fritzsche
  • agrucza
  • dmorvai
  • nish343
  • kolosh
  • azorahai3904
  • skrivoo
  • mark.adorjan
  • burci
  • dimitrovn
  • ivanfroehlich
  • iulianmihai
  • xueboliang
  • greszter
  • bercziand
  • criley
  • drewhodsonsap
  • jviesersap
  • sixstep
  • sap-jjf
  • sapfs
  • attilamuller01
  • scotthetrick
  • oliverweisenburger
  • maurogreco
  • nicolaeciumac
  • asciortino1
  • pendicg24
  • marton.matusek
  • adamszabolcs
  • btalos
  • bence.uto
  • daniels1404
  • saphendricksjoerg
  • mmartin2
  • fenyopeti
  • mmothersill
  • brandon-sap
  • pjohnson02
  • mhunyady
  • mengjiao.zhao
  • ushnpm
  • dkorpos
  • xin.he
  • viau
  • zsomborh
  • muddam
  • nvkaur2
  • jbleclerc
  • jamescocker
  • arnaud.buchholz
  • jerryrichardson
  • retfalvibence
  • akapa
  • mkls
  • kaaj
  • knagy
  • rehreth
  • mhegedus
  • mmartin
  • bsoos
  • emarsys-deployer
  • draven
  • judge
  • daniel.banky
  • szeist
  • rgargya
  • marton.papp.emarsys
  • dgyenes
  • s.viktor
  • m4w4q7
  • david.barkoczi
  • qw3r
  • tamas.toth
  • gergaczd
  • gerike
  • alkra
  • epgrubmair
  • morban
  • ettancos
  • epmartini
  • gabor.balla.emarsys
  • mzsombor
  • ejpersson
  • ejwalker
  • llosonczy
  • iben12
  • kartonfarkas
  • adamoa
  • mbarna
  • peva
  • bforgacs
  • kozma
  • ngabor84
  • zerosuxx
  • edosrecki
  • eadaniel
  • selator
  • kkimak
  • gaborb
  • glendvai
  • lveraszto
  • rdoczi
  • fentosi
  • boristomic
  • mbazso
  • dmihalek
  • lhalasz
  • evspasevski
  • dsztanko
  • tbugar
  • fqqdk
  • eggarcia
  • menyhertfatyol
  • zoltanrideg-emarsys
  • sarakoll
  • mmolnar-emar
  • attila.gal
  • benjamingehl
  • tdorkaa
  • lkonya
  • gpap_ema
  • vimtaai
  • lloki-emarsys
  • borzi
  • pmaksa_emarsys
  • dfarago