Python boto3 - Запрос Athena - start_query_execution - Токен безопасности, включенный в запрос, недействителен - PullRequest
0 голосов
/ 05 августа 2020

Мой код для получения запроса Athena:

    self.athenaDataSource = "AwsCatalog"
    self.athenaDB = "prod_myapp_app"
    self.athenaResultBucket = "s3://s3-athena-prod-results/"
    

, и здесь я показываю, что создаю клиента и вызываю .start_query_execution

    clientAthena = boto3.client('athena', region_name=awsRegion)
    athenaQueryExecResp = clientAthena.start_query_execution(
        QueryString=self.athenaQuery,
        QueryExecutionContext={ 'Database': self.athenaDB },
        ResultConfiguration={'OutputLocation': self.athenaResultBucket }
    )
    print("athenaQueryExecResp= "+str(athenaQueryExecResp))
    

Я получаю эту ошибку

botocore.exceptions.ClientError: An error occurred (UnrecognizedClientException) when calling the StartQueryExecution operation: The security token included in the request is invalid.

Дело в том, что это означает, что я не передаю безопасность, которая является правильной, но как мне передать учетные данные. Я проверил https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/athena.html#Athena .Client.start_query_execution , он никогда не упоминает ничего о передаче доступа к учетным данным и токену

...