From 3dffe13045c5889a92ea946351e558f91b83abc6 Mon Sep 17 00:00:00 2001 From: Fujimura Daisuke Date: Fri, 25 Nov 2016 16:46:39 +0900 Subject: [PATCH 1/2] Enable auto table creation 'autoCreate' is consumed in dataset.get and table.get is called with empty option. --- functions/sendgrid/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions/sendgrid/index.js b/functions/sendgrid/index.js index a8327a2499..6bd5cf64dd 100644 --- a/functions/sendgrid/index.js +++ b/functions/sendgrid/index.js @@ -271,10 +271,9 @@ exports.sendgridWebhook = function sendgridWebhook (req, res) { */ function getTable () { const dataset = bigquery.dataset(config.DATASET); - const options = { autoCreate: true }; - return dataset.get(options) - .then(([dataset]) => dataset.table(config.TABLE).get(options)); + return dataset.get({autoCreate: true}) + .then(([dataset]) => dataset.table(config.TABLE).get({autoCreate: true})); } // [END functions_sendgrid_get_table] From d49f4845eb29f1f75035f9a32c5acaee417aee9c Mon Sep 17 00:00:00 2001 From: Daisuke Fujimura Date: Tue, 29 Nov 2016 09:58:15 +0900 Subject: [PATCH 2/2] Add missing spaces --- functions/sendgrid/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/sendgrid/index.js b/functions/sendgrid/index.js index 6bd5cf64dd..bb79508565 100644 --- a/functions/sendgrid/index.js +++ b/functions/sendgrid/index.js @@ -272,8 +272,8 @@ exports.sendgridWebhook = function sendgridWebhook (req, res) { function getTable () { const dataset = bigquery.dataset(config.DATASET); - return dataset.get({autoCreate: true}) - .then(([dataset]) => dataset.table(config.TABLE).get({autoCreate: true})); + return dataset.get({ autoCreate: true }) + .then(([dataset]) => dataset.table(config.TABLE).get({ autoCreate: true })); } // [END functions_sendgrid_get_table]