I am having the same problem as: python adds "E" to string
All the answers given are relevant, but I am breaking my neck on this one.
The problem is that psycopg2 not only escapes values, but also schema, table and column names like this:
CREATE TABLE E'Tablename' (E'identificatie' VARCHAR(16))
Which it simply shouldn't! How van I get rid of the E and '' for table names and columns but maintain them for field values?
the alternative
'CREATE TABLE ' + tablename + ' (' + fieldname... %
makes it vulnerable to sql injection all over again.
Stuck between a rock and a hard place..