Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-bigquery

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-bigquery - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

lib/put.js

17

lib/get.js

@@ -7,10 +7,13 @@ var request = require('request');

return function ( url, cb ) {
return function ( url, nextPageToken, cb ) {
if (typeof nextPageToken === 'function') {
cb = nextPageToken;
delete nextPageToken;
}
getToken(function ( err, token ) {
if (err) { return cb(err); }
console.log('requesting to: ' + url);
request.get({
var getParams = {
url: 'https://www.googleapis.com/bigquery/v2' + url,

@@ -20,4 +23,8 @@ qs: {

}
}, function ( err, res, body ) {
}
if (nextPageToken) {
getParams.qs.pageToken = nextPageToken;
}
request.get(getParams , function ( err, res, body ) {
if ( err || res.statusCode !== 200 ) {

@@ -24,0 +31,0 @@ //console.log(err || res);

@@ -1,2 +0,2 @@

var request = require('request');
var request = require('request');
var bigquery = function ( options ) {

@@ -18,2 +18,3 @@

service.getProjects = require('./getProjects')(options);
service.tabledata = require('./Tabledata')(options);

@@ -20,0 +21,0 @@ return service;

@@ -22,3 +22,3 @@ var request = require('request');

//console.log(err || res);
cb('there was a problem executing your query');
cb(err);
} else {

@@ -25,0 +25,0 @@ cb(undefined,body);

@@ -5,3 +5,4 @@ var Tables = function ( options ) {

del = require('./del')(options),
get = require('./get')(options);
get = require('./get')(options),
put = require('./put')(options);

@@ -26,2 +27,6 @@ return {

get(url, cb);
},
patch: function ( id, datasetId, projId, patchObj, cb) {
var url = '/projects/' + projId + '/datasets/' + datasetId + '/tables/' + id;
put(url, patchObj, cb);
}

@@ -28,0 +33,0 @@ };

{
"name": "google-bigquery",
"description": "node.js package for accessing google bigquery through a service account",
"version": "0.1.2",
"version": "0.1.3",
"author": {

@@ -6,0 +6,0 @@ "name": "Gustavo Machado",

@@ -400,2 +400,87 @@ var assert = require('assert'),

});
describe('tabledata', function() {
var projId = null;
var datasetId = null;
before(function( done ) {
client.getProjects(function (err, projs) {
projId = projs.projects[0].id;
client.datasets.getAll(projId, function (err, datasets) {
//get the first.
datasetId = datasets.datasets[0].datasetReference.datasetId;
done();
});
});
});
it('should insert data into a table', function( done ) {
var tableId = "tesTable" + ~~(Math.random() * 100000);
var table = {
friendlyName: tableId,
tableReference: {
projectId: projId,
datasetId: datasetId,
tableId: tableId
},
schema: {
fields: [
{ name: 'col1', type: 'STRING' }
]
}
};
var rows = [{
json: {
col1: 'test1'
}
}, {
json: {
col1: 'test2'
}
}];
client.tables.create(table, function () {
client.tabledata.insertAll(rows, projId, datasetId, tableId, function (err, result) {
assert.equal(undefined, err);
assert.ok(result);
assert.equal('bigquery#tableDataInsertAllResponse', result.kind);
//cleanup
client.tables.delete(tableId, datasetId, projId, function (){});
done();
});
});
});
it('should list data of a table', function( done ) {
client.tables.getAll(datasetId, projId, function (err, tables) {
var tableId = tables.tables[0].tableReference.tableId;
client.tabledata.list(projId, datasetId, tableId, {}, function (err, results) {
assert.equal(undefined, err);
assert.ok(results);
assert.equal('bigquery#tableDataList', results.kind);
done();
});
});
});
it('should list only one of a table', function( done ) {
client.tables.getAll(datasetId, projId, function (err, tables) {
var tableId = tables.tables[0].tableReference.tableId;
client.tabledata.list(projId, datasetId, tableId, {maxResults: 2}, function (err, results) {
assert.equal(undefined, err);
assert.ok(results);
assert.equal(2, results.rows.length);
done();
});
});
});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc