Wolf Wiegand schrieb:
cur.execute("\\COPY packages_on_systems FROM '/tmp/tmpFCpuv_'")
However, this always returns the error:
pgdb.DatabaseError: error 'ERROR:  syntax error at or near "\" at

The problem is that you can only execute SQL commands that way.
"\COPY" is not a SQL command, but one of the psql meta-commands.
Luckily, there is also a SQL version of the \COPY command.
The syntax is similar, but without the backslash.

There are some subtle differences between a psql \copy and a sql copy, concerning escape characters and file permissions.

See also "man psql" or "psql -c '\h copy'" or the section on the SQL copy command in the PostgreSQL documentation.

Alternatively, you can also use the inserttable command from the classic PyGreSQL interface pg.py, which is also based on \copy.

-- Christoph


_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql

Reply via email to