我找到了很多用于查询数据并将数据插入 BigQuery 的 node.js
示例,但没有找到有关如何删除和更新数据库中的行的任何示例或 API 说明。我知道这些限制(距离上次更改后 30 分钟等)。
我发现的唯一提示是从 vscode
bigQuery.dataset(dataset).table(table).deleteFromBigQuery('noIdea')
但即使是 vscode 也无法给我有关更新的提示。
你知道这方面的 nodejs
文档吗?
我一直在寻找的一些资源 query examples by googleapis和 DMLs google Manual
最佳答案
建立在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);
}
关于node.js - BigQuery : Questions on Delete and Update rows using nodejs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52672242/