我已经在Amazon上配置了一个PostgresSQL数据库实例,并希望从python脚本中使用它。我用的是游侠。
下面是python脚本。
import awswrangler as wr
df1 = pd.DataFrame({
"id": [1, 2],
"name": ["foo", "boo"]
})
eng_postgresql = wr.db.get_engine(db_type="postgresql", host=ENDPOINT, port=5432, database=DBNAME, user=USR, password=pass)
wr.db.to_sql(df1, eng_postgresql, schema="public", name="tutorial", if_exists="replace", index=False) # PostgreSQL我得到了以下错误:
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Operation timed out
Is the server running on host "*************.rds.amazonaws.com" (172.31.23.226) and accepting
TCP/IP connections on port 5432?发布于 2020-10-12 05:09:01
基于这些评论。
由于RDS 不是公共而导致的连接超时。随后,互联网上的连接将失败。
这个问题一般有三种解决办法;
https://stackoverflow.com/questions/64311331
复制相似问题