【发布时间】:2017-10-25 10:20:39
【问题描述】:
我正在尝试将数据帧写入 postgres 。对于使用的 DBAPI 是 psycogp2。
localconn='postgresql+psycopg2://postgres/PSWD@localhost:5432/localPG'
localEng=engine.create_engine(localconn)
df.to_sql("DUMMY", localEng)
但是它的抛出错误(psycopg2.OperationalError) could not translate host name postgres to address: Name or service not known
localPG 是数据库名称。
我哪里做错了?
【问题讨论】:
标签: python python-2.7 postgresql