[英]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.我有一个 python lambda,它将向 Athena 调用 SQL 查询,以便为我的 lambda 计算提取某些数据。 How do I unit test Athena queries in the lambda?如何在 lambda 中对 Athena 查询进行单元测试? As lambda uses some other services I used MOTO to mock services.由于 lambda 使用了一些其他服务,因此我使用 MOTO 来模拟服务。
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.我认为您可以在本地编写单元测试代码,只要将业务逻辑与 lambda 特定代码(如偶数和上下文)分开即可。 Here is an example. 这是一个例子。
Unfortunately, moto has not supported Athena yet.不幸的是,moto 尚未支持 Athena。 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 GitHub - 摩托
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.