Hi all,
I am using
“@google-cloud/bigquery”: “^6.2.0”,
https://github.com/googleapis/nodejs-bigquery
I want to create delete the table data and Insert into same table.
import { BigQuery } from '@google-cloud/bigquery';
async function runQuery_truncate_table() {
console.log(" this is truncate_table")
const query = 'TRUNCATE TABLE `ghistory`';
const options = {
query: query,
};
const [job] = await bigquery.createQueryJob(options);
console.log(`Job ${job.id} Deleted .`);
}
// main run
// let dt1 = await runQuery_truncate_table().catch(console.error);
// //setInterval(runQuerydelete_table, 1500);
async function main() {
await runQuery_truncate_table();
// await datainsert();
}
main();
client truncate run after the data insert. it was not happens all time,