【问题标题】:How to export raw data feeds from Google Big Query to R servers in a CSV tabular format?如何以 CSV 表格格式将原始数据源从 Google Big Query 导出到 R 服务器?
【发布时间】:2014-09-25 19:36:59
【问题描述】:

我尝试使用链接https://cloud.google.com/bigquery/exporting-data-from-bigquery中提到的Python代码

但是,在运行代码时,它表示由于该表具有嵌套架构,因此不允许将其导出为 CSV。

我的目标是将原始每日提要从 Big Query 环境提取到本地 R Server 环境,以便对点击流进行自定义统计。

请帮帮我!

【问题讨论】:

  • 您需要将结果展平。我的建议是在 BigQuery 浏览器中找到适合您的查询(默认情况下结果是展平的)。然后将其保存为该屏幕中的视图并在您的代码中使用该视图。如果它不起作用,请告诉我。

标签: python json csv google-bigquery


【解决方案1】:

嵌套或重复的数据无法导出为 CSV。您可以改为将 BigQuery 表导出为 JSON。您关注的 python 示例应该可以工作,您只需在提取作业的配置中添加 destinationFormat,例如 https://cloud.google.com/bigquery/exporting-data-from-bigquery#extractconfig

'destinationFormat': 'NEWLINE_DELIMITED_JSON'

有关此参数的文档:https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.extract.destinationFormat

【讨论】:

    猜你喜欢
    • 2017-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-27
    • 2018-12-25
    • 1970-01-01
    相关资源
    最近更新 更多