Amazon web services 接收错误属性验证失败:[属性{/TableInput/ViewOriginalText}的值与类型{String}不匹配]AWS cloudformation

Amazon web services 接收错误属性验证失败:[属性{/TableInput/ViewOriginalText}的值与类型{String}不匹配]AWS cloudformation,amazon-web-services,amazon-cloudformation,aws-glue,aws-cloudformation-custom-resource,Amazon Web Services,Amazon Cloudformation,Aws Glue,Aws Cloudformation Custom Resource,我试图使用表中的数据创建外部视图,但收到错误属性验证失败:[属性{/TableInput/ViewOriginalText}的值与类型{String}不匹配,同时使用云结构在AWS glue中创建视图 任何关于决议的想法都将不胜感激。下面是我正在使用的yaml文件代码片段 提前谢谢 --- AWSTemplateFormatVersion: 2010-09-09 Description: "Glue Athena database and table configuration&quo

我试图使用表中的数据创建外部视图,但收到错误属性验证失败:[属性{/TableInput/ViewOriginalText}的值与类型{String}不匹配,同时使用云结构在AWS glue中创建视图

任何关于决议的想法都将不胜感激。下面是我正在使用的yaml文件代码片段

提前谢谢

---
AWSTemplateFormatVersion: 2010-09-09
Description: "Glue Athena database and table configuration"
Parameters:

  MarketingAndSalesDatabaseName:
    Type: String
    MinLength: "4"
    Default: "marketingandsales_qs"
    Description: "Name of the AWS Glue database to contain this CloudFormation template's tables."

  SalesPipelineTableName:
    Type: String
    MinLength: "4"
    Default: "salespipeline_qs"
    Description: "Name of the Sales Pipeline data table in AWS Glue."

Resources:

  ### AWS GLUE RESOURCES ###

  MarketingAndSalesDatabase:
    Type: "AWS::Glue::Database"
    Properties:
      DatabaseInput:
        Description: "Marketing and Sales database (Amazon QuickSight Samples)."
        Name: !Ref MarketingAndSalesDatabaseName
      CatalogId: !Ref AWS::AccountId

  SalesPipelineTable:
    Type: "AWS::Glue::Table"
    DependsOn: MarketingAndSalesDatabase
    Properties:
      TableInput:
        Description: "Sales Pipeline table (Amazon QuickSight Sample)."
        TableType: "VIRTUAL_VIEW"
        Parameters: {
                "CrawlerSchemaDeserializerVersion": "1.0",
                "compressionType": "none",
                "classification": "csv",
                "recordCount": "16831",
                "typeOfData": "file",
                "CrawlerSchemaSerializerVersion": "1.0",
                "columnsOrdered": "true",
                "objectCount": "1",
                "delimiter": ",",
                "skip.header.line.count": "1",
                "averageRecordSize": "119",
                "sizeKey": "2002910",
                "presto_view": "true"
        }
        StorageDescriptor:
          StoredAsSubDirectories: False
          Parameters: {
                  "CrawlerSchemaDeserializerVersion": "1.0",
                  "compressionType": "none",
                  "classification": "csv",
                  "recordCount": "16831",
                  "typeOfData": "file",
                  "CrawlerSchemaSerializerVersion": "1.0",
                  "columnsOrdered": "true",
                  "objectCount": "1",
                  "delimiter": ",",
                  "skip.header.line.count": "1",
                  "averageRecordSize": "119",
                  "sizeKey": "2002910"
          }
          InputFormat: "org.apache.hadoop.mapred.TextInputFormat"
          OutputFormat: "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"
          Columns:
            - Type: string
              Name: salesperson
            - Type: string
              Name: lead_name
        ViewOriginalText:
          'Fn::Sub':
            - '/* Presto View: ${View} */'
            - View:
                 'Fn::Base64': !sub '{"catalog": "awsdatacatalog",
                                  "schema":"default",
                                  "columns": [ { "name": "salesperson", "type": "varchar" }, { "name": "lead_name", "type": "varchar" }],
                                  "originalSql": "SELECT salesperson AS salesperson, lead_name AS lead_name FROM marketing_qs_1"
                  }'
        Retention: 0
        Name: !Ref SalesPipelineTableName
      DatabaseName: !Ref MarketingAndSalesDatabaseName
      CatalogId: !Ref AWS::AccountId

这些属性应位于下方,而不是:

Compressed:False
地点:!Sub“s3://${DataBucketName}/sales/”
建议在编写模板时尝试以内联方式查看其中一些错误:

[cfn lint]E3002:在Resources/SalesPipelineTable/Properties/TableInput/ViewOriginalText中,Property是一个对象而不是字符串

在以下内容中也不需要:


[cfn lint]W1020:Fn::Sub是不需要的,因为Resources/SalesPipelineTable/Properties/TableInput/ViewOriginalText/Fn::Sub/1/View/Fn::Base64/Fn::Sub在原始博文中编辑了新代码供您参考谢谢@pat的回复,我已经使用cfn lint修复了这些问题。我面临新问题E3002属性的类型应为Resources/SalesPipelineTable/Properties/TableInput/ViewOriginalText中的String not List。抱歉,我是这些cloudformation脚本的新手,因此无法找到此问题的解决方案。谢谢你advance@John我想我可能已经用额外的评论把你弄糊涂了,因为现在已经从中删除了太多。原件应该是Fine谢谢@Pat的回复。我已经做了更改,并在原来的帖子中发布。cfn lint未显示任何错误,但云形成表示YAML的形式不好。你能看看它,并找出它为什么会给我一个错误,提前谢谢!