How to use the gcloud.bigquery function in gcloud

To help you get started, we’ve selected a few gcloud examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jasonpolites / gcf-recipes / bigquery / app / index.js View on Github external
var _getBQClient = function() {
  if (bigquery === null) {
    bigquery = gcloud.bigquery({
      // We're using the API from the same project as the Cloud Function
      projectId: process.env.GCP_PROJECT,
    });
  }
  return bigquery;
};
github hakobera / lambda-kinesis-bigquery / KinesisBigQuery.js View on Github external
exports.handler = function(event, context) {
  var bigquery = gcloud.bigquery({
    projectId: config.project,
    keyFilename: 'gcpkey.json'
  });
  var table = bigquery.dataset(config.dataset).table(config.table);
  var rows = [], i, l, kinesis;

  console.log(config);
  console.log(JSON.stringify(event, null, '  '));
  var now = Math.floor(Date.now() / 1000);
  for(i = 0, l = event.Records.length; i < l; ++i) {
    kinesis = event.Records[i].kinesis;
    var sequenceNumber = kinesis.sequenceNumber;
    try {
      var payload = JSON.parse(new Buffer(kinesis.data, 'base64').toString('utf8'));
      rows.push(_.merge({ id: sequenceNumber, time: now }, payload));
    } catch (err) {
github hakobera / mongobq / lib / gcp.js View on Github external
BigQueryTable.prototype.bq = function () {
  return gcloud.bigquery(this.projectSettings);
};

gcloud

Google Cloud APIs Client Library for Node.js

Apache-2.0
Latest version published 8 years ago

Package Health Score

69 / 100
Full package analysis