【问题标题】:Specifying Region in Dataflow reading BigQuery Dataset python SDK在读取 BigQuery 数据集 python SDK 的数据流中指定区域
【发布时间】:2019-05-23 14:31:50
【问题描述】:

我正在尝试读取数据流中的 bigquery 数据集。它找不到我指定的 bigquery 数据集/表。

job_name 是 preprocess-ga360-190523-130005

我的 datalab vm、gcs 存储桶和 bigquery 数据集都位于 europe-west2。

由于某种原因,它正在搜索位置 'US' 中的数据集

modules versions are apache-beam 2.5.0,google-cloud-dataflow 2.0.0, google-cloud-bigquery 0.25.0

搜索了文档,但无法找到为什么会发生这种情况的答案。

OUTPUT_DIR = "gs://some-bucket/some-folder/"

#dictionary of pipeline options
options = {
    "staging_location": "gs://some-bucket/some-folder/stage/"
    "temp_location": "gs://some-bucket/some-folder/tmp/"
    "job_name": job_name,
    "project": PROJECT,
    "runner": "DirectRunner",
    "location":'europe-west2',
    "region":'europe-west2',
}

#instantiate PipelineOptions object using options dictionary
opts = beam.pipeline.PipelineOptions(flags = [], **options)

#instantantiate Pipeline object using PipelineOptions
with beam.Pipeline(options=opts) as 
    outfile = "gs://some-bucket/some-folder/train.csv"
    (
      p | "read_train" >> beam.io.Read(beam.io.BigQuerySource(query = 
my_query, use_standard_sql = True))
        | "tocsv_train" >> beam.Map(to_csv)
        | "write_train" >> beam.io.Write(beam.io.WriteToText(outfile))
    )
print("Done")

回复:

HttpError: HttpError 访问 https://www.googleapis.com/bigquery/v2/projects/projects/queries/querystring: 响应:, 内容

【问题讨论】:

    标签: python google-cloud-dataflow apache-beam


    【解决方案1】:

    在 Apache Beam 2.5.0 Python SDK 中,non US query sources weren't yet supported

    似乎在 Apache Beam 2.8.0 Python SDK [Release Notes, PR, JIRA] 中添加了支持。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-17
      • 1970-01-01
      • 1970-01-01
      • 2021-06-14
      • 1970-01-01
      • 2019-04-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多