简体   繁体   English

如何使用 boto3 RDS 客户端 Z2778840A0100CB30C982876741B0B5A2Z 服务器 select 查询在 AWS lambda 中运行

[英]How to run RDS SQL Server select queries in AWS lambda using boto3 RDS client python?

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. 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?难道我们没有任何选项可以在 AWS lambda 中运行 RDS SQL 查询吗? Any ideas!有任何想法吗!

rds_client = boto3.client('rds')

boto3 library provides API to communicate with AWS API. boto3 库提供 API 与 AWS API 通信。 The AWS RDS API includes of AWS RDS API 包括

  1. Listing all RDS Instances列出所有 RDS 实例
  2. Create new RDS Instances创建新的 RDS 实例
  3. Stop RDS Instances停止 RDS 实例
  4. Modify RDS Instances修改 RDS 实例
  5. etc ETC

For Lambda or any programming language to communicate with database server, we first need to install database driver.对于 Lambda 或任何编程语言与数据库服务器通信,我们首先需要安装数据库驱动程序。 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. Boto3 不附带任何关系数据库驱动程序。

To allow Lambda to work your RDS SQL Server, you have to install Python's SQL Server driver and upload to Lambda.要让 Lambda 工作在您的 RDS SQL 服务器上,您必须安装 Python 的 SQL 服务器驱动程序并上传到 Z04A7DA3C5B35BCAD8B51A7DA3C5B5B5B4EE 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.您可以将 package 作为独立的zip或将其作为Lambda 层,可供多个 Z04A7DA923154BCADBZDAEE1 函数使用。 The commonly used SQL Server driver for python is pyodbc python常用的SQL服务器驱动是pyodbc

Someone on medium.com have make a blogpost about this. medium.com上有人对此发表了一篇博文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM