[英]RuntimeValueProviderError when creating a google cloud dataflow template with Apache Beam python
[英]RuntimeValueProviderError when Running Dataflow Template Job
試圖弄清楚為什么我會收到這些錯誤。 快速搜索只是得到了提到損壞版本的答案,但這里似乎並非如此。 創建模板工作正常,但是當我運行它時(並且當我通過限制 arg 時)我收到以下錯誤。 這個想法是建立基於模板中提供的 arguments 的查詢。 如果有更好的選擇,我願意接受。
代碼:
class Options(PipelineOptions):
@classmethod
def _add_argparse_args(cls, parser):
parser.add_value_provider_argument(
'--limit',
default=0,
type=int,
help='Limit the amount of rows retrieved'
)
...
def from_bq(options):
with beam.Pipeline(options=options) as p:
(p
| 'Read From BQ' >> beam.io.ReadFromBigQuery(query=NestedValueProvider(options.limit, create_query), use_standard_sql=True)
)
def create_query(limit):
query = """
SELECT * FROM ...
"""
if limit > 0:
query = query + " LIMIT {limit}".format(limit=limit)
return query
錯誤:
raise error.RuntimeValueProviderError('%s not accessible' % obj)
apache_beam.error.RuntimeValueProviderError: NestedValueProvider(value: RuntimeValueProvider(option: limit, type: int, default_value: 0), translator: create_query) not accessible [while running 'Read From BQ/Read/Split-ptransform-324']
運行 apache-beam 版本 2.27.0。
我認為標准模板不可能做到這一點。 您應該考慮使用具有非模板管道的完全靈活性的Flex 模板。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.