Thi*_*ijs 5 python google-cloud-dataflow apache-beam
我正在对一小组数据测试一些管道,然后在一次测试运行期间我的管道突然崩溃并显示以下消息: Not found: Dataset thijs-dev:nlthijs_ba was not found in location US
INFO:root:Using location 'EU' from table我的运行脚本
python pippeline/main.py --project thijs-dev --region europe-west4 --runner DataflowRunner --temp_location gs://thijs/dataflow/tmp --staging_location gs://thijs/dataflow/staging --job_name thijspipe --save_main_session --setup_file pipeline/setup.py --autoscaling_algorithm=THROUGHPUT_BASED --max_num_workers=7
我失败的一步
thijs = (p | 'ReadTable thijs' >> beam.io.Read(beam.io.BigQuerySource(query=queries.load_code_table(), use_standard_sql=True)))
示例我的查询是什么样的
#standardSQL
select
original.c1,
original.c2,
original.c3
from `thijs.tablename` original
inner join (
select c1, max(c2) as col2 from `thijs.tablename` group by c2)
timejoin on timejoin.c5 = original.c5 and timejoin.c2 = original.c2
Run Code Online (Sandbox Code Playgroud)
我的问题是:究竟出了什么问题,这个美国来自哪里?
错误
RuntimeError: apitools.base.py.exceptions.HttpNotFoundError: HttpError accessing <https://www.googleapis.com/bigquery/v2/projects/thijs-dev/jobs?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Sun, 16 Feb 2020 09:40:10 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'status': '404', 'content-length': '338', '-content-encoding': 'gzip'}>, content <{ "error": { "code": 404, "message": "Not found: Dataset thijs-dev:`nlthijs_ba was not found in location US", "errors": [ { "message": "Not found: Dataset thijs-dev:`nlthijs_ba was not found in location US", "domain": "global", "reason": "notFound" } ], "status": "NOT_FOUND" } } > [while running 'Transform Details Thijs']
[更新]
在这里,您可以看到我通过在查询中使用 #standardsql 作为第一行来强制使用 standardsql。但是在某个地方,某些 API 正在强制使用旧 SQL,而我不知道是什么或在哪里。
RuntimeError: apitools.base.py.exceptions.HttpBadRequestError: HttpError accessing <https://www.googleapis.com/bigquery/v2/projects/thijs-dev/jobs?alt=json>: response: <{'vary': 'Origin, X-Origin, Referer', 'content-type': 'application/json; charset=UTF-8', 'date': 'Sun, 16 Feb 2020 20:59:12 GMT', 'server': 'ESF', 'cache-control': 'private', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'status': '400', 'content-length': '354', '-content-encoding': 'gzip'}>, content <{ "error": { "code": 400, "message": "Query text specifies use_legacy_sql:false, while API options specify:true", "errors": [ { "message": "Query text specifies use_legacy_sql:false, while API options specify:true", "domain": "global", "reason": "invalid" } ], "status": "INVALID_ARGUMENT" } } > [while running 'pipeline']
Python SDK 2.16.0 & 2.19.0
始终建议您使用 Google BigQuery,您应该输入 BigQuery 资源的完整名称。我是什么意思?在您的代码中使用相同的示例:
select
original.c1,
original.c2,
original.c3 from `thijs.tablename` original
inner join ( elect c1, max(c2) as col2 from `thijs.tablename` group by c2)
timejoin on timejoin.c5 = original.c5 and timejoin.c2 = original.c2
Run Code Online (Sandbox Code Playgroud)
thijs.tablename您应该使用而不是仅放置:thijs-dev.nlthijs_ba.table_name
这样,您就可以确保在 BigQuery 上调用正确的资源。
您应该首先检查的另一件事是您是否可以首先使用 Python 通过简单查询来查询该表:
thijs.tablename从c2 分组中选择 c1, max(c2) 作为 col2
如果此查询的调用失败,您应该首先检查。
| 归档时间: |
|
| 查看次数: |
2065 次 |
| 最近记录: |