如何为从 python SDK 发送到 firehose 的 JSON 定义 AWS GLUE 架构?

How to define AWS GLUE schema for JSON sent from python SDK to firehose?

我想到了这个设置:

PythonSDK 发送预定义 JSON -> aws kinesis firehose -> 使用 AWS GLUE 模式将数据转换为“Parquet” -> 将数据保存到 S3(无论是否成功)。

虽然发送基本类型如字符串、整数和布尔值很容易,但发送 array/struct 一点也不简单。 我不断收到以下奇怪的错误消息:

The schema is invalid. Error parsing the schema: Error: type expected at the position 0 of 'STRUCTname:STRING,id:BIGINT,is_bla:BOOLEAN' but 'STRUCT' is found.

The schema is invalid. Error parsing the schema: Error: type expected at the position 0 of 'ARRAY' but 'ARRAY' is found.

  1. 为什么我会收到这些错误消息?
  2. 是否有适合模式数据类型的doc/examples? 我只能找到 this saying Column Type should match the "Single-line string pattern".

我来回答我的问题:

保存 GLUE 模式与将数据发送到流水线之间存在一些延迟。我发送的更新 JSON 使用旧模式,因此出现错误。

同样来自 and 我们必须自己验证一些命名约定,很遗憾 AWS 在创建时没有这样做。