Issue with Creating Datasets in Amazon QuickSight Using Boto3

I’m experiencing an issue when creating datasets in Amazon QuickSight using Boto3. After invoking the create_dataset method, I want to check the status of the dataset creation. However, when I use the describe_dataset method, it always returns a 200 status code, regardless of whether the dataset has been successfully created or if it is still in progress.

I have also tried using the console commands to check the dataset status, but they yield the same results. The describe_dataset method does not provide clear status information about the dataset creation process, leading to confusion. I can only determine the dataset’s status by checking the Amazon QuickSight UI, which is not ideal for automation.

Has anyone else encountered this issue? Is there a recommended approach or workaround to reliably check if a dataset has been created successfully using Boto3, or is there any way to get more informative status feedback from the API?

Thank you for your help!

Hi @pablo - When you have executed the create_dataset, you should receive the status of the dataset creation process as part of response. if there is no error, you can describe the data set to get all the details about the data set and list data set to check whether the data set is created or not.

Regards,
Sanjeeb

Hi @pablo,

If you get status code 200, it means that the dataset has been created successfully. It is considered as already created even if the initial ingestion is still in progress. If you want to check if the initial ingestion has completed, you can use ListIngestions and look at IngestionStatus where the RequestType is “INITIAL_INGESTION”.

image

Thanks you so much @David_Wong , i count not find it on documentation.

I have the same issue with the topic creations, do you know how to check that status too?
When i create a topic using create_topic on boto3 i have the following response:

{‘ResponseMetadata’: {‘RequestId’: ‘b8c511ba-2997-4a9c-b282-177b58e2a279’,
‘HTTPStatusCode’: 200,
‘HTTPHeaders’: {‘date’: ‘Tue, 22 Oct 2024 20:48:12 GMT’,
‘content-type’: ‘application/json’,
‘content-length’: ‘274’,
‘connection’: ‘keep-alive’,
‘x-amzn-requestid’: ‘b8c511ba-2997-4a9c-b282-177b58e2a279’},
‘RetryAttempts’: 0},
‘Status’: 200,
‘Arn’: ‘arn:aws:quicksight:us-east-1:185763106874:topic/teramot-conti-1_prd_15’,
‘TopicId’: ‘teramot-conti-1_prd_15’,
‘RefreshArn’: ‘arn:aws:quicksight:us-east-1:185763106874:topic/teramot-conti-1_prd_15/refresh/1729630092078’,
‘RequestId’: ‘b8c511ba-2997-4a9c-b282-177b58e2a279’}

but the topic takes a time to fully create

Hi @pablo,

When you get status code 200 with CreateTopic, you’ll see a RefreshArn in the response. That RefreshArn contains a RefreshId.

Use the RefreshId with DescribeTopicRefresh and you’ll get the refresh status in the response.

@pablo In your sample response, the RefreshId is 1729630092078.

Dear @David_Wong,

Thank you very much for your assistance.

I would like to ask you one more question, if possible. I am trying to generate an embed URL for a QuickSight analysis using the following function:

python

Copy code

def generate_analysis_embed_url(self, analysis_id, session_duration=15):
    try:
        response = self.quicksight_client.generate_embed_url_for_registered_user(
            AwsAccountId=self.aws_account_id,
            SessionLifetimeInMinutes=session_duration,
            UserArn=self.user_arn,
            ExperienceConfiguration={
                "Dashboard": {
                    "InitialDashboardId": analysis_id
                }
            }
        )
        print(f"Embed URL for analysis generated: {response['EmbedUrl']}")
        return response['EmbedUrl']
    except Exception as e:
        print(f"Error generating the embed URL for analysis: {e}")
        return None

The analysis was created by my user from the QuickSight UX, but when I attempt to open the embed URL, I encounter issues that seem related to permissions. This is puzzling to me, as I am using the same User ARN. Do you have any insights on where the problem might originate?

On the embed url i have the following message:

We can’t open that dashboard

This usually happens when you don’t have access permission, it’s from another QuickSight account, or it was deleted.

Sign in to another QuickSight account. You’ll be signed out of company first.

Thank you in advance for your help.

Best regards,

Hi @pablo,

Are you trying to embed a dashboard or an analysis? The API takes a dashboard ID - not an analysis ID.

image

Hi

Yes, @David_Wong , you were right, but I still can’t achieve what I’m trying to do, and I’m not sure if it’s actually possible. I want to create an embedded dashboard that is editable by the user.

I’ve already tried QuickSight Q, but it’s not what I’m looking for.

Do you know if this is possible through code using the API?

@pablo
You can’t embed an analysis but you can embed the QuickSight console which includes analyses.
image

You can set the InitialPath to an analysis.

Hello @David_Wong , yes, that works well for me. The thing is, I’m trying to automate the creation of an editable dashboard that can be embedded in a front end.

So far, I’ve managed to:

  1. Create the datasource using boto3
  2. Create the dataset using boto3

What I still need is to be able to create an analysis, even if it’s empty, and assign it a dataset so that the user can edit it embedded in the front end.

Have you tried creating your analysis using the API?

After creating it, you’ll get an analysis id. You can them embed the console and set the initial path to that analysis id.

Hi @pablo,
It’s been awhile since we last heard from you, did you have any additional questions regarding your initial post?

If we do not hear back within the next 3 business days, I’ll go ahead and close out this topic.

Thank you!

Hi @pablo,
Since we haven’t heard back, I’ll close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.

Thank you!