Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unit test aws athena sql queries in python lambda?

I have a python lambda that will call an SQL query to Athena for pulling certain data for my lambda calculation. How do I unit test Athena queries in the lambda? As lambda uses some other services I used MOTO to mock services.

like image 592
pyhotshot Avatar asked Feb 15 '26 00:02

pyhotshot


1 Answers

I think you can write an unit test code locally as long as the business logic is separated from lambda specific code like even and context. Here is an example.

Unfortunately, moto has not supported Athena yet. You can make an issue to request a new feature with your use cases or you can make new pull request. Anyway the community would help you. GitHub - moto

like image 197
toshiya Avatar answered Feb 17 '26 15:02

toshiya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!