如何在appflow中自动映射字段?

问题描述

我将尝试通过云形成自动创建 appflow。我在源中有多个字段(130+),我无法手动映射它。在 UI 中,我可以直接选择多列,但从 cloudformation 中我必须指定,因此查看是否有任何选项会自动从源中获取所有列。

AWstemplateFormatVersion: "2010-09-09"
Metadata:
    Generator: "Automation"
Description: ""
Parameters:
  sNowusername:
    Type: String
    MaxLength: 128
  sNowpassword:
    Type: String
    MaxLength: 128
  ServiceNowUrl:
    Type: String
    MaxLength: 180
Resources:
    AppFlowFlowTest:
        Type: "AWS::AppFlow::Flow"
        Properties:
            FlowName: "IMGroupTest"
            Description: "ServiceNow"
            SourceFlowConfig:
                ConnectorType: "ServiceNow"
                ConnectorProfileName: !Ref AppFlowConnectorProfile
                SourceConnectorProperties:
                    ServiceNow:
                        Object: "business_service_group"
            DestinationFlowConfigList:
              -
                ConnectorType: "S3"
                DestinationConnectorProperties:
                    S3:
                        BucketName: "raw-data
                        BucketPrefix: "serviceNow/appflow"
                        S3OutputFormatConfig:
                            FileType: "PARQUET"
                            PrefixConfig:
                                PrefixType: "FILENAME"
                            AggregationConfig:
                                AggregationType: "None"
            TriggerConfig:
                TriggerType: "ondemand"
            Tasks:
              -
                SourceFields:
                  - "id"
                  - "site_name"
                  .
                  .
                  .
                  .

解决方法

要映射所有字段,您必须将 taskTypeMap_all 一起使用,并且 SourceFields 和任务属性将为空。

    tasks=[
        {
            'sourceFields': [],'taskType':'Map_all','taskProperties: '{}'
        },]