我正在编写一个 Python 脚本,它将文件从一个目录复制到另一个目录,并将该文件名复制到一个文档存档 PostgreSQL 表中。我收到的错误如下:
Camt' 在命名游标上多次调用 excute()
下面是我的代码:
cursor = conn.cursor('cur', cursor_factory=psycopg2.extras.DictCursor)
cursor.execute('SELECT * FROM doc_archive.table LIMIT 4821')
row_count = 0
for row in cursor:
row_count += 1
print "row: %s %s\r" % (row_count, row),
pathForListFiles = srcDir
files = os.listdir(pathForListFiles)
for file in files:
print file
try:
# Perform an insert with the docid
cursor.execute("INSERT INTO doc_archive.field_photo_vw VALUES)