BigQuery 表架构类型在 apache beam 中未正确转换

BigQuery table schema types not being translated correctly in apache beam

提问人:Joe Moore 提问时间:8/25/2023 更新时间:8/31/2023 访问量:54

问:

目前,python Apache Beam SDK for BigQuery 中存在一个错误,该错误将 BQ 错误地转换为 BQ 。这似乎已经修复,但我有一种感觉,它可能在预发布中,而不是最新的稳定版本(2.49.0)。TIMESTAMPDATETIME

这出现在描述转换时输入/输出架构不匹配的错误中。仅当使用存储写入 API 时,此错误才适用。旧版流式处理 API 工作正常。

SDK 将转换为 ,而不是 。我想知道在修复(相对)新错误之前,是否有人现在找到了解决方法?LOGICAL_TYPE<beam:logical_type:micros_instant:v1>DATETIMETIMESTAMP

python google-bigquery 投射 google-cloud-dataflow apache-beam

评论

1赞 Bihag Kashikar 8/28/2023
可能不是可能的解决方法,但是,请查看存储读取 API - beam.apache.org/documentation/io/built-in/google-bigquery/...

答:

1赞 Joe Moore 8/31/2023 #1

对于遇到相同问题的人,请在写入 BigQuery 之前添加此行

# imports
from apache_beam.typehints.schemas import LogicalType, MillisInstant

# logical type mapping
LogicalType.register_logical_type(MillisInstant)

Apache Beam 开发人员已经意识到了这个问题,并正在努力寻找更永久的解决方案。