Skip to content

cursor.copy_from() method doesn't work with quoted named tables #47

@otaviomguerra

Description

@otaviomguerra

The error below is thrown when trying to copy a CSV file into a given Postgres table that have quotes in the name in order to use CamelCase style.

The Error message is:

pg.ProgrammingError: ERROR:  syntax error at or near "User"
LINE 1: copy "public."User"" from stdin (format csv,delimiter ','...

The code that generates the error:

cursor.copy_from(file, "public.\"User\"", null="") 

where file is the csv file object and the second argument is the schema.table name

Trying others names to the schema.table such as 'public."User"' or any variations doesn't work.

I assume the problem is not a Postgres internal problem because the code above works with psycopg2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions