psycopg2.ProgrammingError:“ stdin”处或附近的语法错误。尝试从redshift复制时出错 [英] psycopg2.ProgrammingError: syntax error at or near "stdin" error when trying to copy_from redshift
本文介绍了psycopg2.ProgrammingError:“ stdin”处或附近的语法错误。尝试从redshift复制时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试复制到AWS redshift时遇到此问题。
这是我要运行的代码:
I am having this problem when I am trying to copy to AWS redshift. This is the code I am trying to run:
with open('path/to/files, 'rb') as fo:
cursor.copy_from(fo, 'schema.table', sep=',')
cursor.commit()
我遇到了错误:
psycopg2.ProgrammingError: syntax error at or near "stdin"
LINE 1: ...Y schema.table FROM stdin WITH...
我正在使用psycopg2运行python 3.5。
希望你们能提供帮助!
I am running python 3.5 with psycopg2. Hope that you guys can help! Thx in advance!
推荐答案
AWS Redshift不是PostgreSQL,尽管它支持PostgreSQL语法和功能的子集。
AWS Redshift is not PostgreSQL, though it supports a subset of PostgreSQL syntax and functionality.
它没有 COPY ...从STDIN c复制。
有关如何使用的信息,请参见手册。在Redshift上复制
。
See the manual for how to use COPY
on Redshift.
这篇关于psycopg2.ProgrammingError:“ stdin”处或附近的语法错误。尝试从redshift复制时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文