将json对象反序列化到faust record,其中json在键名中有连字符

ruoxqz4g  于 2021-06-04  发布在  Kafka
关注(0)|答案(0)|浏览(253)

我有一个json对象

{ 
  "timestamp": "2020-06-24T15:32:56.775518Z",
  "record-type": "data",
  "operation": "load",
  "partition-key-type": "primary-key",
  "schema-name": "legacy",
  "table-name": "test"
}

我想把这些记录反序列化成

class MetadataModel(faust.Record):
    timestamp: str
    record-type: str  # does not work, hyphens in name not allowed
    schema_name: str  # does not work
    tableName: str    # does not work

我可能遗漏了一些简单的东西,但是如何从键中带有连字符的json对象转到python对象呢。任何帮助都将不胜感激!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题