简体   繁体   English

如何在python lambda中对aws athena sql查询进行单元测试?

[英]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.

相关问题 如何在 python 上模拟 aws 时间流以进行单元测试? - How to mock aws timestream for unit test on python? 如何在 Python Lambda 中有效读取 AWS Athena 响应 - Ho to read AWS Athena response effectively in Python Lambda 连接 Athena 中的变量 SQL 查询来自 Python Lambda ZC1C425268E68385D14ZA5074CF - Concatenate variable in Athena SQL query from Python Lambda function AWS Python Athena 安装错误 pip 安装 jupyter-athena-sql - AWS Python Athena Install Error on pip install jupyter-athena-sql 如何使用 python 脚本将 Pandas 数据帧写入 AWS Athena 表 - How to write a pandas dataframe to AWS Athena table using python script 如何为AWS Lambda捆绑Python - How to bundle Python for AWS Lambda AWS Lambda 使用 Python 和 pyodbc 连接到 SQL - AWS Lambda connecting to SQL with Python and pyodbc 从 boto3 在 AWS Athena 中运行查询提供了错误的权限 - Run queries in AWS Athena from boto3 gives bad permissions 使用 Python 的 AWS Lambda 集成测试的代码覆盖率报告 - Code Coverage Report for AWS Lambda Integration test using Python 如何使用 FastAPI 和 GremlinPython 在 JanusGraph 上对 Gremlin 查询进行单元测试 - How to unit test Gremlin Queries on JanusGraph using FastAPI and GremlinPython
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM