【发布时间】:2020-12-10 08:19:22
【问题描述】:
我目前正在编写一个将写入 RDS 数据库的 AWS Lambda。我可以从数据库中读取数据,但是在尝试写入数据库时连接超时。我想知道是否是因为我试图从 aws lambda 中将 geopandas DF 写入 Postgres 数据库,如下所示:
eng = create_engine('postgresql://' + 'postgres_db' + \
':' + 'password' + \
'@' + 'host_loc' + \
':' + 'port' + \
'/' + 'db_name')
.
.
.
.
df1.to_postgis('table1', con=eng, if_exists='replace', index=False)
df2.to_postgis('table2', con=eng, if_exists='replace', index=False)
但是脚本一直失败:
Response:
{
"errorMessage": "Task timed out after 3.00 seconds"
}
geopandas 的 to_postgis 函数是否会导致此问题,我将如何纠正此问题?我知道我可以从数据库中读取数据,因为我已经从 lambda 环境中成功地测试过了。该脚本仅在尝试使用 to_postgis 将 geopandas 数据帧写入我的 postgres 实例中的 postgis 时才会失败。
【问题讨论】:
-
会不会是这个写操作耗时超过3秒所以需要增加Lambda函数的超时设置?
标签: amazon-web-services aws-lambda amazon-rds geopandas