【问题标题】:Use bigquery php client library to create an external table link to cloud storage使用 bigquery php 客户端库创建指向云存储的外部表链接
【发布时间】:2017-08-16 12:00:33
【问题描述】:

从 Google Cloud Console,我们可以手动创建外部 bigquery 表,该表将链接到 Google 云存储 Json 换行分隔文件。

但在 bigquery php 客户端库 https://cloud.google.com/bigquery/docs/tables 中,我找不到示例代码让我创建链接到云存储保存的 json 文件的 bigquery 外部表。

function create_table($projectId, $datasetId, $tableId, $schema)
{
  $bigQuery = new BigQueryClient([
    'projectId' => $projectId,
  ]);
  $dataset = $bigQuery->dataset($datasetId);
  $options = ['schema' => $schema];
  $table = $dataset->createTable($tableId, $options);
  return $table;
}

这是否意味着无法通过 bigquery 客户端库“创建外部 bigquery 表”?

谢谢!

【问题讨论】:

    标签: google-bigquery


    【解决方案1】:

    它可以通过客户端库获得。在您提供的示例 sn-p 中,“模式”被指定为“选项”。外部表定义是您可以指定的另一个选项。这是底层的表资源:https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#resource

    externalDataConfiguration 部分是您创建外部(又名联合)BigQuery 表时需要指定的部分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-21
      • 2016-12-15
      • 2016-01-17
      • 1970-01-01
      • 1970-01-01
      • 2021-10-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多