0

我正在尝试将Github上的基本示例连接到 BigQuery。我npm install --save gcloud按照建议做了,它似乎安装正确。还有什么我需要安装的吗?

==================================================== =============

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
4

1 回答 1

2

这是文档中的错误!发送 PR:https ://github.com/GoogleCloudPlatform/gcloud-node/pull/1067

您将数据导入表,而不是数据集。所以缺少一行,您可以在其中访问一张表:

var schoolsTable = schoolsDataset.table('table-id');
于 2016-01-18T16:11:00.963 回答