【发布时间】:2022-08-18 18:13:49
【问题描述】:
我正在尝试使用 PubSub Subscription \"Write to BigQuery\",但遇到了 \"REPEATED\" 列类型的问题。更新订阅时收到的消息是
字段 \'Values\' 的架构模式不兼容:字段在主题架构中是必需的,但在 BigQuery 表架构中是重复的
我的 Avro 架构是:
{ \"type\": \"record\", \"name\": \"Avro\", \"fields\": [ { \"name\": \"ItemID\", \"type\": \"string\" }, { \"name\": \"UserType\", \"type\": \"string\" }, { \"name\": \"Values\", \"type\": [ { \"type\": \"record\", \"name\": \"Values\", \"fields\": [ { \"name\": \"AttributeID\", \"type\": \"string\" }, { \"name\": \"AttributeValue\", \"type\": \"string\" } ] } ] } ] }输入“匹配”模式的 JSON:
{ \"ItemID\": \"Item_1234\", \"UserType\": \"Item\", \"Values\": { \"AttributeID\": \"TEST_ID_1\", \"AttributeValue\": \"Value_1\" } }我的表看起来像:
ItemID | STRING | NULLABLE UserType | STRING | NULLABLE Values | RECORD | REPEATED AttributeID | STRING | NULLABLE AttributeValue | STRING | NULLABLE我能够 \"Test\" 和 \"Validate Schema\" 并成功返回。问题是,我在 Avro 上为 Values 节点缺少什么以使其成为“REPEATED”与“必需”以创建订阅。
标签: publish-subscribe google-cloud-pubsub