python - Athena query fails with boto3 (S3 location invalid) -
i'm trying execute query in athena, fails.
code:
client.start_query_execution(querystring="create database if not exists db;", queryexecutioncontext={'database': 'db'}, resultconfiguration={ 'outputlocation': "s3://my-bucket/", 'encryptionconfiguration': { 'encryptionoption': 'sse-s3' } })
but raises following exception:
botocore.errorfactory.invalidrequestexception: error occurred (invalidrequestexception) when calling startqueryexecution operation: s3 location provided save query results invalid. please check s3 location correct , in same region , try again. if continue see issue, contact customer support further assistance.
however, if go athena console, go settings , enter same s3 location (for example):
the query runs fine.
what's wrong code? i've used api of several other services (eg, s3) successfully, in 1 believe i'm passing incorrect parameters. thanks.
python: 3.6.1. boto3: 1.4.4
the s3 location provided save query results invalid. please check s3 location correct , in same region , try again.
since works when use console, bucket in different region 1 using in boto3
. make sure use correct region (the 1 worked in console) when constructing boto3
client. default, boto3
use region configured in credentials file.
Comments
Post a Comment