Skip to content

Instantly share code, notes, and snippets.

@goodpic
Last active September 15, 2018 22:16
Show Gist options
  • Save goodpic/328d87aa75a0d951e895e2445ad2f96f to your computer and use it in GitHub Desktop.
Save goodpic/328d87aa75a0d951e895e2445ad2f96f to your computer and use it in GitHub Desktop.
Node.js client to delete BigQuery table
const program = require('commander');
const { deleteTable } = require('../src/bigquery');
program
.version('0.1.0')
.option('-t, --table [table]', 'Specify the table to drop', '')
.option('-d, --dataset [datasetId]', 'Specify the dataset of the table to drop.', '')
.parse(process.argv);
if (program.table) {
console.log(`Drop table: ${program.table}`);
const datasetId = program.dataset ? program.dataset : 'stats';
deleteTable({
datasetId,
tableId: program.table
}).then(() => console.log(`${program.table} dropped.`));
} else {
console.log('Please specifiy the table to create by "-t TABLE_NAME"');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment