熊猫df.to_sql不适用于redshift

时间:2019-01-31 16:25:10

标签: python-3.x pandas

igers = create_engine('postgres://%s:%s@%s/ibdrs' %(igersUser, igersPwd, igersHost), encoding="utf-8")
df.to_sql('Table_Named_Something', igers, if_exists='replace', schema='Schema', index = False)

使用上面的代码,我得到一个错误(psycopg2.ProgrammingError) Relation "Table_Named_Something" already exists

我认为if_exists ='replace'应该删除并重新创建表;我错了吗?为什么在redshift上不起作用?

1 个答案:

答案 0 :(得分:0)

这听起来很奇怪,但是我遇到了同样的问题,当我将表名更改为小写时,问题就解决了。