【问题标题】:Move query results to another location将查询结果移动到另一个位置
【发布时间】:2019-10-29 19:50:11
【问题描述】:

我在 python 文件中定义了一个 Airflow DAG。想对美国本地化的 bigquery 公共数据运行查询,并将结果存储在我在欧盟位置的 biquery 中。在一个 DAG 步骤中管理操作会很棒。

使用如下代码,但会抛出错误:将位置设置为美国,但输出数据集在另一个位置。

get_data = bigquery_operator.BigQueryOperator(
  ...
  location='US',
  sql="""
    select ...
    from 'bigquery-public-data.new_tork_taxi_trips.tlc_green_trips_2018'''
  """,
  destination_dataset_table=<my-proj>.<my-dataset>.<my-table>,
  ...
)

【问题讨论】:

    标签: google-cloud-platform airflow


    【解决方案1】:

    请参阅 BigQuery 文档中的 Temporary and permanent tables,当您将查询结果写入永久表时,您要查询的表必须与包含目标表的数据集位于同一位置。

    参考:https://cloud.google.com/bigquery/docs/managing-tables#limitations_on_copying_tables

    【讨论】:

    • 是的,这是一个解决方案。是否可以在美国查询结果,将结果存储为临时表,然后编写另一个步骤来使用已创建的临时表并将结果存储在欧盟?避免两次具体化数据会很好。
    猜你喜欢
    • 1970-01-01
    • 2014-08-18
    • 1970-01-01
    • 1970-01-01
    • 2017-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多