Last active
September 15, 2018 22:16
-
-
Save goodpic/328d87aa75a0d951e895e2445ad2f96f to your computer and use it in GitHub Desktop.
Node.js client to delete BigQuery table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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