微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

DataFormatConversion.InvalidSchema 在 AWS Glue 和 Firehose 中使用连字符/破折号

如何解决DataFormatConversion.InvalidSchema 在 AWS Glue 和 Firehose 中使用连字符/破折号

我有这个 CloudFormation glue 模板,它在结构字段之一中包含一个连字符:

  Testglue:
    Type: AWS::glue::Table
    Properties:
      CatalogId: !Ref AWS::AccountId
      DatabaseName: testdatabase
        Name: 'test'
        StorageDescriptor:
          Location: "s3://testpath"
          Columns:
            - Name: test
              Type: struct<testcol:string,item-testcol:string>

此表用于 Kinesis Firehose 记录转换,但每当我尝试发送数据进行处理时,都会出现以下错误。有没有办法强制使用破折号或连字符,到目前为止我无法将其更改为下划线,因为当前数据使用连字符并且会产生很大影响。

"lastErrorCode":"DataFormatConversion.InvalidSchema","lastErrorMessage":"The schema is invalid. Error parsing the schema: Error:: expected at the position XX of 'struct<testcol:string,item-testcol:string>' but '-' is found."

解决方法

由于 Glue 数据目录在 Hive Metastore 上运行,我认为在名称中使用破折号是不可能的。

,

正如@Robert 也提到的,Glue 不支持在列名中使用“连字符”。

来自 Glue 文档:

When you create schema in AWS Glue to query in Athena,consider the following:

- database name cannot be longer than 252 characters.
- table name cannot be longer than 255 characters.
- column name cannot be longer than 128 characters.
- The only acceptable characters for database names,table names,and column names are lowercase letters,numbers,and the underscore character.

有关详细信息,请参阅 Glue best practices

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。