如何使用boto3 RDS客户端python在AWS Lambda中运行RDS SQL Server选择查询? [英] How to run RDS SQL Server select queries in AWS lambda using boto3 RDS client python?

查看:205
本文介绍了如何使用boto3 RDS客户端python在AWS Lambda中运行RDS SQL Server选择查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看AWS boto3 rds文档用于在AWS lambda中使用python的RDS SQL Server中存在的表上运行sql select查询,但是我没有找到任何信息.我们是否没有选择在AWS Lambda中运行RDS SQL查询?任何想法!

I am going through AWS boto3 rds documentation for running sql select query on table which is present in RDS SQL Server using python in AWS lambda, but I didn't find any info. Don't we have any option to run RDS SQL queries in AWS lambda? Any ideas!

rds_client = boto3.client('rds')

推荐答案

boto3库提供用于与AWS API通信的API.AWS RDS API包括

boto3 library provides API to communicate with AWS API. The AWS RDS API includes of

  1. 列出所有RDS实例
  2. 创建新的RDS实例
  3. 停止RDS实例
  4. 修改RDS实例

要使Lambda或任何编程语言与数据库服务器通信,我们首先需要安装数据库驱动程序.将其视为收集编程语言指令的中间人(驱动程序),将其转换为数据库可理解的语言,然后由数据库对其进行处理并将信息返回给中间人,然后中间人将其转换为您的编程内容语言能听懂.Boto3不附带任何关系数据库驱动程序.

For Lambda or any programming language to communicate with database server, we first need to install database driver. Think of it as a middle-man (drivers) that collect instructions of programming language, convert it to database understandable language, then database to process it and return the information to the middle-man, and middle-man translate it to something your programming language can understand. Boto3 does not come with any relational database drivers.

要允许Lambda使用RDS SQL Server,您必须安装Python的SQL Server驱动程序并上传到Lambda.您可以将其打包为独立的 zip 或将其设置为可以使用的 Lambda层跨多个Lambda函数.python常用的SQL Server驱动程序是

To allow Lambda to work your RDS SQL Server, you have to install Python's SQL Server driver and upload to Lambda. You can either package it as a standalone zip or make it as a Lambda Layer that can be used across by multiple Lambda Functions. The commonly used SQL Server driver for python is pyodbc

中号.com 对此发表了一篇博文.

Someone on medium.com have make a blogpost about this.

这篇关于如何使用boto3 RDS客户端python在AWS Lambda中运行RDS SQL Server选择查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆