Boto3 create_analysis from describe_analysis_definition is incorrect

I have noticed that when using create_analysis from a definition obtained in describe_analysis_definition, the analysis created gives me an error if validation_strategy=STRICT, and if validation_strategy=LENIENT, the analysis created contains errors… And many of them!

For example, I have an analysis that shows 624 differences between the original analysis and the one I have created using boto3, some of them being:

"root['Sheets'][3]['Visuals'][18]['TableVisual']['ConditionalFormatting']['ConditionalFormattingOptions'][1]['Cell']['FieldId']": { 'new_value': 'f7b343b0-bc2e-446a-af7d-ec0c08e22685.4.1699360848028', 'old_value': '64d20c19-6735-41f6-ab71-1ec8c11eb9a5.3.1699360548099'}, "root['Sheets'][3]['Visuals'][18]['TableVisual']['ConditionalFormatting']['ConditionalFormattingOptions'][3]['Cell']['FieldId']": { 'new_value': '64d20c19-6735-41f6-ab71-1ec8c11eb9a5.3.1699360548099', 'old_value': 'f7b343b0-bc2e-446a-af7d-ec0c08e22685.4.1699360848028'}, "root['Sheets'][3]['Visuals'][18]['TableVisual']['ConditionalFormatting']['ConditionalFormattingOptions'][3]['Cell']['TextFormat']['BackgroundColor']['Solid']['Expression']": { 'new_value': '{_processor_KPI_rank_color_worst} > 5', 'old_value': '{_processor_KPI_rank_color_worst} <= 5'}, "root['Sheets'][3]['Visuals'][18]['TableVisual']['ConditionalFormatting']['ConditionalFormattingOptions'][3]['Cell']['TextFormat']['BackgroundColor']['Solid']['Color']": { 'new_value': '#B6F5AC', 'old_value': '#FD8082'}, "root['Sheets'][3]['Visuals'][18]['TableVisual']['ConditionalFormatting']['ConditionalFormattingOptions'][4]['Cell']['FieldId']": { 'new_value': '64d20c19-6735-41f6-ab71-1ec8c11eb9a5.3.1699360548099', 'old_value': 'f7b343b0-bc2e-446a-af7d-ec0c08e22685.4.1699360848028'}

I would like to ask about this process, how can I improve it so that the reconstruction of the analysis is complete?

Code attached below

    def get_analysis_definition_from_name(name):
        """Get analysis definition from name"""
    
        quicksight_analysis_manager = QuicksightAnalysisManager()
    
        # Get the list of analyses
        paginator_list_analyses = quicksight_analysis_manager.get_analysis_list()
    
        # Iterate over each analysis
        for list_analyses in paginator_list_analyses:
            for analysis in list_analyses["AnalysisSummaryList"]:
                if analysis["Name"] == name and analysis["Status"] != "DELETED":
                    logging.info("Analysis %s found", name)
                    return quicksight_analysis_manager.describe_analysis_definition(analysis["AnalysisId"]) 

    # If the analysis is not found, return None. Otherwise, return the analysis definition
    logging.warning("Analysis %s not found", name)
    return None

    def describe_analysis_permissions(self, analysis_id):
        """Describe analysis permissions"""
        quicksight_client = self.manager_configuration.create_client()
        return quicksight_client.describe_analysis_permissions(
            AwsAccountId=self.manager_configuration.account_id,
            AnalysisId=analysis_id
        )

    def create_analysis(self, new_analysis_description, new_analysis_permissions, validation_strategy):
        """Create analysis"""
        quicksight_client = self.manager_configuration.create_client()
        return quicksight_client.create_analysis(
            AwsAccountId=self.manager_configuration.account_id,
            AnalysisId=new_analysis_description["AnalysisId"],
            Name=new_analysis_description["Name"],
            Definition=new_analysis_description["Definition"],
            Permissions=new_analysis_permissions["Permissions"],
            ValidationStrategy=validation_strategy
        )

   analysis_manager = QuicksightAnalysisManager()

    logging.info("Check analysis restore capacity - Preprocessing info for analysis %s", analysis_name)

    # Original
    original_analysis_definition = get_analysis_definition_from_name(analysis_name)

    # New analysis for testing
    test_analysis_name = "test_" + analysis_name
    test_analysis_id = str(uuid.uuid4())
    test_analysis_description = {"AnalysisId": test_analysis_id,
                                 "Name": test_analysis_name,
                                 "Definition": original_analysis_definition['Definition']}
    test_analysis_permissions = {
        "Permissions": analysis_manager.describe_analysis_permissions(original_analysis_definition['AnalysisId'])}
    test_validation_strategy = {"Mode": "LENIENT"}

    logging.info("Check analysis restore capacity - Creating analysis %s",test_analysis_name)

    analysis_manager.create_analysis(test_analysis_description,
                                     test_analysis_permissions['Permissions'],
                                     test_validation_strategy)

Thanks for your time!

@albmargar ,

Kindly log a support ticket for this issue.

Here are the steps for opening a support ticket - Creating support cases and case management - AWS Support . If your company has someone who manages your AWS account, you might not have direct access to AWS Support and will need to raise an internal ticket to your IT team or whomever manages your AWS account. They should be able to open an AWS Support case on your behalf

Kind regards,
Koushik

2 Likes

Hello @albmargar, since we have not heard back from you, I will archive this topic. If you still need assistance with this issue after filing a ticket with support, please post a new topic in the community and link to this question to provide relevant information. That will ensure you are at the top of the priority list for a response from one of our QuickSight experts. Thank you!