我找到了许多node.js
示例来查询数据并将数据插入BigQuery,但是没有找到任何示例以及关于如何删除和更新数据库中行的API描述。我知道这些限制(自上次更改以来30分钟等)。
我从vscode
那里得到的唯一提示
bigQuery.dataset(dataset).table(table).deleteFromBigQuery('noIdea')
但是即使是vscode也无法给我有关更新的提示。
您知道有关此的任何nodejs
文档吗?
我一直在寻找的一些资源 query examples by googleapis和 DMLs google Manual
答案 0 :(得分:3)
以sync_query
example为基础:
async function runDeleteQuery(projectId) {
// Imports the Google Cloud client library
const BigQuery = require('@google-cloud/bigquery');
/**
* TODO(developer): Uncomment the following line before running the sample.
*/
// const projectId = "your-project-id";
// Modify this query however you need
const sqlQuery = "DELETE FROM dataset.table WHERE condition;";
// Creates a client
const bigquery = new BigQuery({projectId});
// Query options list: https://cloud.google.com/bigquery/docs/reference/v2/jobs/query
const options = {
query: sqlQuery,
timeoutMs: 100000, // Time out after 100 seconds.
useLegacySql: false, // Use standard SQL syntax for queries.
};
// Runs the query
await bigquery.query(options);
}