【发布时间】:2020-07-29 17:56:20
【问题描述】:
我正在查询 API,将其存储到 pandas 数据帧,对其进行转换,然后将其写入 AWS Redshift 数据库。在我的本地机器上没有问题,一切正常。当我将代码放在 AWS Lambda 中时,我收到了这个错误:
Calling the invoke API action failed with this message: Network Error
我读到这可能是由于它可以写入数据库的行数限制,然后我尝试只向数据库写入 1 行但仍然出现相同的错误。
我写的代码是这样的:
conn = create_engine('postgresql://user:password@redshifteu-west-1.redshift.amazonaws.com:5439/dev')
result.to_sql('table_1', conn, index=False, if_exists='replace', schema='schema')
我正在使用 pandas to_sql 方法和 sqlalchemy。如何使用 AWS Lambda 将我的数据帧写入 Redshift 数据库?
【问题讨论】:
标签: python pandas amazon-web-services aws-lambda amazon-redshift