Google bigquery 如何向现有bigquery表添加说明?
我正在寻找一种向现有表属性添加说明的方法,是否有任何简单的命令行命令,如“alter table zzz add description…”来实现此目的?您可以通过web UI向表及其字段添加说明-这将是最简单的方法 同样通过API,将此文档端点与PATCH()方法结合使用: 也可以使用bq命令行工具:Google bigquery 如何向现有bigquery表添加说明?,google-bigquery,Google Bigquery,我正在寻找一种向现有表属性添加说明的方法,是否有任何简单的命令行命令,如“alter table zzz add description…”来实现此目的?您可以通过web UI向表及其字段添加说明-这将是最简单的方法 同样通过API,将此文档端点与PATCH()方法结合使用: 也可以使用bq命令行工具: bq update --description "My table" existing_dataset.existing_table Google有一个新的API,Google.Cloud.
bq update --description "My table" existing_dataset.existing_table
Google有一个新的API,Google.Cloud.BigQuery.V2,可以通过NuGet获得。使用新API更新表说明的操作如下:
// instantiate a client for big query
// depending on the API version, this will be either BigqueryClient or BigQueryClient
BigqueryClient bqClient = BigqueryClient.Create(projectId, credential);
// get an instance of the tables resource using the client
TablesResource resource = new TablesResource(bqClient.Service);
// get the table definition from big query
TablesResource.GetRequest get = resource.Get(projectId, datasetId, tableId);
Table tbl = get.Execute();
// set the description property
tbl.Description = "New Description";
// save the changes to the table definition
TablesResource.PatchRequest patch = resource.Patch(tbl, projectId, datasetId, tableId);
patch.Execute();
// instantiate a client for big query
// depending on the API version, this will be either BigqueryClient or BigQueryClient
BigqueryClient bqClient = BigqueryClient.Create(projectId, credential);
// get an instance of the tables resource using the client
TablesResource resource = new TablesResource(bqClient.Service);
// get the table definition from big query
TablesResource.GetRequest get = resource.Get(projectId, datasetId, tableId);
Table tbl = get.Execute();
// set the description property
tbl.Description = "New Description";
// save the changes to the table definition
TablesResource.PatchRequest patch = resource.Patch(tbl, projectId, datasetId, tableId);
patch.Execute();