Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
google-bigquery
Advanced tools
node.js package for accessing google bigquery through a service account
Access Google BigQuery using a service account from node.js
For the sake of simplicity, the entities returned by Google's webservice are being used, so you can refer to Google's site https://developers.google.com/bigquery/docs/reference/v2/ for further documentation. For the entire usage of the API you can go see the test\tests.js file, here are some samples:
var bigquery = require('google-bigquery'),
client = bigquery({
"iss": '1234567890@developer.gserviceaccount.com',
"key": fs.readFileSync('mypemfile.pem', 'utf8')
});
client.getProjects(function (err, projs) {
console.log(projs);
console.log(projs.projects); //list of projects.
});
client.tables.create({... your table resource ...}, function (err, table){
console.log(table);
console.log(table.tableReference.tableId); //table's id.
});
In order to execute the tests, first set up an environment variable 'GOOGLE_ISS' with the ISS taken from your Google API Service Account (notice that you have to register your Google API account for BigQuery first), something like this: "abcdefghij@developer.gserviceaccount.com". You also have to get a .pem with your private key to sign the token requests. To get this .pem file, create a service account in Google API's console, and download the .p12 file. In linux you can convert the .p12 file with openssl using the following command (notice the -nodes):
openssl -in yourp12file.p12 -out file.pem -nodes
Copy your .pem file to the 'test' folder, and then run the tests using mocha or npm test.
Notice: these tests are going to be hitting your bigquery account directly, so I recommend setting a tests project, and setting the mocha timeout to 10 seconds (mocha --timeout 10000 test/tests.js).
The MIT License : http://opensource.org/licenses/MIT
Copyright (c) 2011-2012 Gustavo Machado. http://machadogj.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
node.js package for accessing google bigquery through a service account
The npm package google-bigquery receives a total of 0 weekly downloads. As such, google-bigquery popularity was classified as not popular.
We found that google-bigquery demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.