I’m trying to create a lambda function that will refresh my quicksight dataset after my ETL processes is finished (i will use stepfunctions to trigger this lambda)
Here is my code:
import boto3
import time
import sys
client = boto3.client("quicksight")
data_set_map = {}
data_set_map['name'] = [data_set_id]
ingestion_id = [str(int(time.time()))][0]
data_set_id = data_set_map[key][0]
def lambda_handler(event, context):
client.create_ingestion(DataSetId=data_set_id,IngestionId=ingestion_id,
AwsAccountId=account_id,IngestionType='FULL_REFRESH')
while True:
response = client.describe_ingestion(DataSetId=data_set_id,IngestionId=ingestion_id,AwsAccountId=account_id)
if response['Ingestion']['IngestionStatus'] in ('INITIALIZED', 'QUEUED', 'RUNNING'):
time.sleep(10) #change sleep time according to your dataset size
elif response['Ingestion']['IngestionStatus'] == 'COMPLETED':
print("refresh completed. RowsIngested {0}, RowsDropped {1}, IngestionTimeInSeconds {2}, IngestionSizeInBytes {3}".format(
response['Ingestion']['RowInfo']['RowsIngested'],
response['Ingestion']['RowInfo']['RowsDropped'],
response['Ingestion']['IngestionTimeInSeconds'],
response['Ingestion']['IngestionSizeInBytes']))
break
else:
print("refresh failed! - status {0}".format(response['Ingestion']['IngestionStatus']))
sys.exit(1)
return {
'state': "success"
}
I got the error message:
"errorMessage": "An error occurred (InvalidParameterValueException) when calling the CreateIngestion operation: DataSet is not accelerated. Will not refresh. datasetId: data-set-id",
"errorType": "InvalidParameterValueException",
Someone has the solutions for this?