Using boto3 and python to call describe_data_set for AWS quicksight throws InvalidParameterValueException but I'm passing a string
Question:
It throws this error
An error occurred (InvalidParameterValueException) when calling the DescribeDataSet operation: The data set type is not supported through API yet.
If I create a string and assign it the value of a valid ID it works just fine?
import boto3
import json
import pandas as pd
acount_id = 'your account'
qs_client = boto3.client('quicksight', region_name='us-east-1')
# LIST ALL DATA SETS
response = qs_client.list_data_sets(
AwsAccountId = acount_id,
MaxResults = 100
)
results = response['DataSetSummaries']
while "NextToken" in response:
response = qs_client.list_data_sets(
AwsAccountId = acount_id,
MaxResults = 100,
NextToken=response["NextToken"]
)
results.extend(response["DataSetSummaries"])
for i in results:
print(i['DataSetId'])
response = qs_client.describe_data_set(
AwsAccountId=acount_id,
DataSetId=i['DataSetId']
)
print(response)
Answers:
I made a few minor changes to your code. I think there may have been an issue with the NextToken logic – I believe you would need to use response.keys() as shown below. The following code works for me and yields the results as shown below.
import boto3
import json
account_id = '0123456789'
session = boto3.Session(profile_name='default')
qs_client = session.client('quicksight')
# LIST ALL DATA SETS
response = qs_client.list_data_sets(AwsAccountId = account_id,MaxResults = 100)
results = response['DataSetSummaries']
while "NextToken" in response.keys():
response = qs_client.list_data_sets(AwsAccountId = account_id,MaxResults = 100,NextToken=response["NextToken"])
results.extend(response["DataSetSummaries"])
for i in results:
x = i['DataSetId']
try:
response = qs_client.describe_data_set(AwsAccountId=account_id,DataSetId=x)
print("succeeded loading: {} for data set {} ".format(x, response['DataSet']['Name']))
except:
print("failed loading: {} ".format(x))
Outputs the following default Quicksight dataset names:
Web and Social Media Analytics
Sales Pipeline
Business Review
People Overview
Your issue is that you have .xlsx or .csv files in your datasets which I don’t believe are supported by the describe_data_set API call. I am in the same boat and am actively looking for code to filter those datasets off. I’ll try to update with some code as I research.
It throws this error
An error occurred (InvalidParameterValueException) when calling the DescribeDataSet operation: The data set type is not supported through API yet.
If I create a string and assign it the value of a valid ID it works just fine?
import boto3
import json
import pandas as pd
acount_id = 'your account'
qs_client = boto3.client('quicksight', region_name='us-east-1')
# LIST ALL DATA SETS
response = qs_client.list_data_sets(
AwsAccountId = acount_id,
MaxResults = 100
)
results = response['DataSetSummaries']
while "NextToken" in response:
response = qs_client.list_data_sets(
AwsAccountId = acount_id,
MaxResults = 100,
NextToken=response["NextToken"]
)
results.extend(response["DataSetSummaries"])
for i in results:
print(i['DataSetId'])
response = qs_client.describe_data_set(
AwsAccountId=acount_id,
DataSetId=i['DataSetId']
)
print(response)
I made a few minor changes to your code. I think there may have been an issue with the NextToken logic – I believe you would need to use response.keys() as shown below. The following code works for me and yields the results as shown below.
import boto3
import json
account_id = '0123456789'
session = boto3.Session(profile_name='default')
qs_client = session.client('quicksight')
# LIST ALL DATA SETS
response = qs_client.list_data_sets(AwsAccountId = account_id,MaxResults = 100)
results = response['DataSetSummaries']
while "NextToken" in response.keys():
response = qs_client.list_data_sets(AwsAccountId = account_id,MaxResults = 100,NextToken=response["NextToken"])
results.extend(response["DataSetSummaries"])
for i in results:
x = i['DataSetId']
try:
response = qs_client.describe_data_set(AwsAccountId=account_id,DataSetId=x)
print("succeeded loading: {} for data set {} ".format(x, response['DataSet']['Name']))
except:
print("failed loading: {} ".format(x))
Outputs the following default Quicksight dataset names:
Web and Social Media Analytics
Sales Pipeline
Business Review
People Overview
Your issue is that you have .xlsx or .csv files in your datasets which I don’t believe are supported by the describe_data_set API call. I am in the same boat and am actively looking for code to filter those datasets off. I’ll try to update with some code as I research.