Google DataFlow 无法在不同位置读写 (Python SDK v0.5.5)

Google DataFlow Cannot read and write in different locations (Python SDK v0.5.5)

我正在使用 Python SDK v0.5.5 编写一个非常基本的 DataFlow 管道。该管道使用带有传入查询的 BigQuerySource,该查询从驻留在欧盟的数据集中查询 BigQuery table。

执行管道时出现以下错误(项目名称匿名):

HttpError: HttpError accessing <https://www.googleapis.com/bigquery/v2/projects/XXXXX/queries/93bbbecbc470470cb1bbb9c22bd83e9d?alt=json&maxResults=10000>: response: <{'status': '400', 'content-length': '292', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'expires': 'Thu, 09 Feb 2017 10:28:04 GMT', 'vary': 'Origin, X-Origin', 'server': 'GSE', '-content-encoding': 'gzip', 'cache-control': 'private, max-age=0', 'date': 'Thu, 09 Feb 2017 10:28:04 GMT', 'x-frame-options': 'SAMEORIGIN', 'alt-svc': 'quic=":443"; ma=2592000; v="35,34"', 'content-type': 'application/json; charset=UTF-8'}>, content <{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalid",
    "message": "Cannot read and write in different locations: source: EU, destination: US"
   }
  ],
  "code": 400,
  "message": "Cannot read and write in different locations: source: EU, destination: US"
 }
}

指定项目、数据集和 table 名称时也会发生错误。但是,从可用的 public 数据集(位于美国,如莎士比亚)中选择数据时没有错误。我也有 jobs 运行 v0.4.4 的 SDK 没有这个错误。

这些版本之间的区别在于临时数据集的创建,如管道启动时的警告所示:

WARNING:root:Dataset does not exist so we will create it

我简要地查看了不同版本的 SDK,差异似乎与这个临时数据集有关。看起来当前版本默认创建一个临时数据集,其位置在美国(取自 master):

我还没有找到禁用这些临时数据集创建的方法。从欧盟数据集中选择数据时,我是不是忽略了什么,或者这确实不再起作用了?

感谢您报告此问题。我假设您正在使用 DirectRunner。我们更改了 DirectRunner 的 BigQuery 读取转换的实现,以创建临时数据集(适用于 SDK 版本 0.5.1 及更高版本)以支持大型数据集。好像我们没有在这里正确设置区域。我们会考虑解决这个问题。

如果您使用在正确区域创建临时数据集的 DataflowRunner,则不应出现此问题。