I tried to perform simple SQL query via Athena SDK. If I run the same SQL query in the web console, I got the correct result. Here is my input:
$athenaClient->startQueryExecution(
array(
'QueryExecutionContext' => array(
'Catalog' => 'AwsDataCatalog',
'Database' => 'db_mydatabase',
),
'QueryString' => 'SELECT * FROM "db_mydatabase"."my_table"',
'ResultConfiguration' => array(
'OutputLocation' => 'S3://my-s3bucket/my-folder/',
),
'WorkGroup' => 'primary',
)
When I query the result via GetQueryExecution(), I got this back:
[Status] => Array
(
[State] => FAILED
[StateChangeReason] => [ErrorCode: INTERNAL_ERROR_QUERY_ENGINE] Amazon Athena experienced an internal error while executing this query. Please contact AWS support for further assistance. You will not be charged for this query. We apologize for the inconvenience.
[SubmissionDateTime] => Aws\Api\DateTimeResult Object
(
[date] => 2022-08-24 15:03:52.024000
[timezone_type] => 3
[timezone] => UTC
)
[CompletionDateTime] => Aws\Api\DateTimeResult Object
(
[date] => 2022-08-24 15:03:54.168000
[timezone_type] => 3
[timezone] => UTC
)
[AthenaError] => Array
(
[ErrorCategory] => 1
[ErrorType] => 401
[Retryable] =>
[ErrorMessage] => [ErrorCode: INTERNAL_ERROR_QUERY_ENGINE] Amazon Athena experienced an internal error while executing this query. Please contact AWS support for further assistance. You will not be charged for this query. We apologize for the inconvenience.
)
)
I know I probably have some setting related issues, as I can get the correct results in Amazon Console. Thanks!