I am trying the basic example on Github to connect to BigQuery. I did npm install --save gcloud
as advised and it seemed to have installed correctly. Is there anything else I need to install?
==============================================================
var gcloud = require('gcloud');
// Authenticating on a per-API-basis. You don't need to do this if you auth on a
// global basis (see Authentication section above).
var bigquery = gcloud.bigquery({
projectId: 'XXXXXX MASKED XXXXXXXXXXX',
keyFilename: './XXXXX MASKED XXXXXXX.json'
});
// Access an existing dataset.
var schoolsDataset = bigquery.dataset('mydataset.mytable');
// Import data into a dataset.
schoolsDataset.import('./myfile', function(err, job) {});
// Get results from a query job.
var job = bigquery.job('job-id');
====================================================================
TypeError: schoolsDataset.import is not a function
at Object.<anonymous> (d:\projects\stock_quotes\app.js:15:22)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:430:10)
at startup (node.js:141:18)
at node.js:980:3
This is a bug in the docs! Sent a PR: https://github.com/GoogleCloudPlatform/gcloud-node/pull/1067
You import data into a table, not a dataset. So one line was missing, where you access a table:
var schoolsTable = schoolsDataset.table('table-id');