[英]In Apache Beam/Dataflow's WriteToBigQuery transform, how do you enable the deadletter pattern with Method.FILE_LOADS and Avro temp_file_format
[英]Apache Beam with Dataflow: flag 'ignore_unknown_columns' for WriteToBigQuery not working
我正在使用 Apache Beam(Python SDK 版本 2.37.0)和 Google Dataflow 構建一個流媒體管道,以將我通過 Pubsub 收到的一些數據寫入 BigQuery。
我處理數據並以這樣的字典表示的行結束:
{'val1': 17.4, 'val2': 40.8, 'timestamp': 1650456507, 'NA_VAL': 'table_name'}
然后我想使用WriteToBigQuery
將值插入到我的表中。
但是,我的表只有列val1
、 val2
和timestamp
。 因此,應忽略NA_VAL
。 根據我對文檔的理解,這應該可以通過設置ignore_unknown_columns=True
來實現。
但是,在 Dataflow 中運行管道時,我仍然收到錯誤消息,並且沒有任何值插入到表中:
There were errors inserting to BigQuery. Will not retry. Errors were [{'index': 0, 'errors': [{'reason': 'invalid', 'location': 'NA_VAL', 'debugInfo': '', 'message': 'no such field: NA_VAL.'}]}]
我試過像這樣的簡單作業配置
rows | beam.io.WriteToBigQuery(
table='PROJECT:DATASET.TABLE',
ignore_unknown_columns=True)
以及那些參數
rows | beam.io.WriteToBigQuery(
table='PROJECT:DATASET.TABLE',
ignore_unknown_columns=True,
create_disposition=beam.io.BigQueryDisposition.CREATE_NEVER,
write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND,
method='STREAMING_INSERTS',
insert_retry_strategy='RETRY_NEVER')
問題:我是否遺漏了一些阻止管道工作的東西? 有沒有人有同樣的問題和/或解決方案?
不幸的是你被蟲子咬了。 這被報告為https://issues.apache.org/jira/browse/BEAM-14039並由https://github.com/apache/beam/pull/16999修復。 版本 2.38.0 將包含此修復程序。 該版本的驗證今天剛剛結束,因此它應該很快就會可用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.