Skip to content

Athena' object has no attribute 'get_query_runtime_statistics'

0

I'm trying to run a Python script in aws glue that uses athena.get_query_runtime_statistics when I run i on my local machine the script works, but running at glue returns this error

asked 2 years ago495 views
1 Answer
0

This could be due to boto3 version that doesn't have Athena get_query_runtime_statistics API [1].

By default, Glue pythonshell job uses boto3 version 1.21.21. However, this API was introduced in boto3 version 1.24.35 onwards. Similarly if you are running Glue Spark jobs, by default, Glue 3.0 uses boto3==1.18.50 [2] which doesn't have this API.

To address this you can upgrade boto3 version by passing following job parameters -

--addtional-python-modules boto3==1.34.131

Please note 1.34.131 is the latest version at the time of writing this. You can replace it with any version that has this API.

If you are using Glue Spark job you can also consider using version 4.0 which uses boto3==1.24.70.

[1]https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/athena/client/get_query_runtime_statistics.html [2]https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-libraries.html#glue-modules-provided

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.