Hello, I have read the previous posts regarding the error “errorMessage”: “‘Quick Sight’ object has no attribute ‘create_refresh_schedule’”, so followed the tips which were suggested like installing latest version of boto but still getting the error.
I have using a docker image and AWS lambda to create new spice datasets and quicksight analysis and dashboards earlier, which was working good. Now I wanted to add schedule refresh to the created dataset,
so I tested by adding this to my code
response = quicksight_client.create_refresh_schedule(
DataSetId=,
AwsAccountId=’ ',
Schedule={
‘ScheduleId’: ‘string’,
‘ScheduleFrequency’: {
‘Interval’: ‘DAILY’,
‘Timezone’: ‘Australia/Sydney’,
‘TimeOfTheDay’: ‘23:30’
},
‘StartAfterDateTime’: datetime(2023, 6, 12),
‘RefreshType’: ‘FULL_REFRESH’
}
)
In my code I have given the datasetId and AWS accound ID.
And my boto version install command in docker image:
RUN pip install boto3 == 1.26.109
STill getting function not found.
Any suggestions.
Thank You
1 Like
Hi @cx-ex-quicksight - Can you please try to use boto3 version - 1.33.8
See the documentation below.
Regards - Sanjeeb
1 Like
Hi @Sanjeeb2022 ,
Still the same error
Hi @cx-ex-quicksight - Can you please check the python version as well.
Regards - Sanjeeb
1 Like
The Python Version used 3.8.
Hi @cx-ex-quicksight - The python version >3.7 should work. Can you please test this is cloud9 shell. Ensure the user you are login should have right privilege to have QS access ( better to check with admin for testing). This will help us in understanding the issue with boto3 or python or permission issue.
Regards - Sanjeeb
@cx-ex-quicksight
I have been using this to do the same, and it works…
You didn’t mention how you created the client, so it is hard to tell.
def get_quicksight_client():
ACCOUNT_ID = settings.AWS.get('ACCOUNT_ID')
ACCESS_KEY = settings.AWS.get('ACCESS_KEY')
SECRET_KEY = settings.AWS.get('SECRET_KEY')
SESSION_TOKEN = settings.AWS.get('SESSION_TOKEN')
session = Session(
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY,
aws_session_token=SESSION_TOKEN,
region_name='us-east-1'
)
client = session.client('quicksight')
return client
def create_refresh_schedule(client, account_id, dataset_id):
response = client.list_refresh_schedules(
AwsAccountId=account_id,
DataSetId=dataset_id
)
if response.get('Status') in (200,201,202):
if response['RefreshSchedules']:
for schedule in response['RefreshSchedules']:
schres = client.delete_refresh_schedule(
AwsAccountId=account_id,
DataSetId=dataset_id,
ScheduleId=schedule['ScheduleId']
)
response = client.create_refresh_schedule(
DataSetId=dataset_id,
AwsAccountId=account_id,
Schedule={
'ScheduleId': f"{uuid.uuid4()}",
'ScheduleFrequency': {
'Interval': 'DAILY',
'Timezone': 'America/New_York',
'TimeOfTheDay': '06:00'
},
'StartAfterDateTime': (datetime.utcnow()+timedelta(hours=1)).strftime('%Y-%m-%d %H:%M:%S'),
'RefreshType': 'FULL_REFRESH',
}
)
if response.get('Status') in (200,201,202):
return response
return None
client = get_quicksight_client()
response = create_refresh_schedule(client, ACCOUNT_ID, dataset_id)