COLUMN_GEOGRAPHIC_ROLE_MISMATCH when create analysis with CDK

get error when create Analysis in CDK

AnalysisError(type=COLUMN_GEOGRAPHIC_ROLE_MISMATCH, message=Required geographic
role for column ‘country’ in data set ‘xxxxxxxxx’ is ‘COUNTRY’, violatedEntities=null)]

How to fix this?

new quicksight.CfnAnalysis(this, 'analysis_daily_active_user', {
      analysisId: `analysis_daily_active_user`,
      name: `Daily Active User Analysis`,
      awsAccountId: this.props.account,
      permissions: [{
        principal,
        actions: [
          'quicksight:DescribeAnalysis',
          'quicksight:UpdateAnalysisPermissions',
          'quicksight:QueryAnalysis',
          'quicksight:UpdateAnalysis',
          'quicksight:RestoreAnalysis',
          'quicksight:DeleteAnalysis',
          'quicksight:DescribeAnalysisPermissions',
        ],
      }],

      sourceEntity: {
        sourceTemplate: {
          arn: props.quickSightProps.templateArn,
          dataSetReferences: [{
            dataSetPlaceholder: 'daily_active_user_view',
            dataSetArn: dataset.attrArn,
          }],
        },
      },

    });

template def:

{
“Placeholder”: “daily_active_user_view”,
“DataSetSchema”: {
“ColumnSchemaList”: [
{
“Name”: “user_type”,
“DataType”: “STRING”
},
{
“Name”: “mobile_brand”,
“DataType”: “STRING”
},
{
“Name”: “country”,
“DataType”: “STRING”,
“GeographicRole”: “COUNTRY”
},
{
“Name”: “event_date”,
“DataType”: “STRING”
}
]
},
“ColumnGroupSchemaList”:
}

}

This is the python documentation for it. It seems as thought it’s a little more that pasting in the Role.

https://docs.aws.amazon.com/cdk/api/v1/python/aws_cdk.aws_quicksight/CfnDataSet.html

Let me know if that helps at all.

1 Like

It works! Thanks Max

2 Likes

So glad this worked for you @liwmin! Thanks for letting us know! Thanks, @Max!