且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用python和psycopg2将数据从S3复制到AWS Redshift

更新时间:2022-11-06 20:40:34

我已经成功使用了此精确设置(psycopg2 + redshift + COPY).之后您承诺了吗? SQL Workbench默认情况下自动提交,而psycopg2默认情况下打开事务,因此直到在连接上调用commit(),数据才可见.

I have used this exact setup (psycopg2 + redshift + COPY) successfully. Did you commit afterwards? SQL Workbench defaults to auto-commit while psycopg2 defaults to opening a transaction, so the data won't be visible until you call commit() on your connection.

完整的工作流程是:

conn = psycopg2.connect(...)
cur = conn.cursor()
cur.execute("COPY...")
conn.commit()

我不认为copy_expert()或任何cursor.copy_ *命令可与Redshift一起使用.

I don't believe that copy_expert() or any of the cursor.copy_* commands work with Redshift.