Catch AWS's TooManyRequestsException when using Pyathena

74 Views Asked by At

I want to use Pyathena to connect to and query an AWS Athena database. Given, that Athena has a hard limit of consecutive running queries (see AWS Athena > Service Quotas), and my application will be running on hundreds of parallel-running worker instances, it can be assumed that in extreme cases a query will fail due to too many queries already being processed/queued. According to the Athena documentation, a TooManyRequestsException error is to be expected in those instances.

I want to handle that specific edge case gracefully in my Python code, but I cannot find any indication as to how this TooManyRequestsException error will propagate. Pyathena's error module doesn't expose an exception with this name, and I couldn't find a reference to this specific error case in the Pyathena documentation.

How can I catch that exception?

0

There are 0 best solutions below