【问题标题】:Adding Column Description to BigQuery schema definition将列描述添加到 BigQuery 架构定义
【发布时间】:2016-04-15 18:53:08
【问题描述】:

是否可以通过 API 在 BigQuery 表的架构定义中指定 cmets?

通过 Hadoop 连接器创建 BigQuery 表时,我使用以下架构

[{"name" : "event_id", "type" : "integer"},{ "name" : "categorization" , "type" : "string" }]

我想要类似的东西

[{"name" : "event_id", "type" : "integer", "description" : "The event identifier"},{ "name" : "categorization" , "type" : "string" }]

编辑:我刚刚用火花连接器试过这个,但它不起作用。描述仍然是空的

BigQueryConfiguration.configureBigQueryOutput(
      bqConfiguration, projectId, bqDatasetId, bqTable, schema)
    bqConfiguration.set(
      "mapreduce.job.outputformat.class",
      classOf[BigQueryOutputFormat[_,_]].getName)

    new JavaPairRDD(rdd.map((null, _))).saveAsNewAPIHadoopDataset(bqConfiguration)
  }

双重编辑:为上下文添加了一些代码

【问题讨论】:

    标签: google-bigquery


    【解决方案1】:

    这正是 BigQuery 为您提供的功能
    您可以在使用Tables: insert API 创建表时执行此操作,也可以使用Tables: patch API 添加到现有表
    请参阅Table Resources中要使用的各个参数
    您可以对整个表格和每个字段进行描述

    【讨论】:

      【解决方案2】:

      是的,表格字段可以有自己的描述。您发布的带有描述的架构在发送到 API 时应该可以工作。

      https://cloud.google.com/bigquery/docs/reference/v2/tables#schema.fields.description

      【讨论】:

      • 用 Spark 连接器尝试过,但不起作用。我的架构有描述,但它们没有显示在列描述中。
      猜你喜欢
      • 1970-01-01
      • 2013-05-18
      • 1970-01-01
      • 2015-10-19
      • 1970-01-01
      • 2021-04-13
      • 2013-09-04
      • 1970-01-01
      • 2020-06-10
      相关资源
      最近更新 更多