psycopg2 / psycopg2.ProgrammingError: syntax error at or near "E'mytable'"

mrdrew afitting at hotmail.com
Fri Apr 2 20:26:12 EDT 2010


Hey all,

Right now I'm completely unable to pass parameters to queries under
any circumstances.  I've got a fairly trivial query as a test...

c.execute('SELECT * FROM %(table_name)s LIMIT 1',
{'table_name':"mytable"})

It fails, giving the error message...

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    c.execute('SELECT * FROM %(table_name)s LIMIT 1',
{'table_name':"mytable"})
psycopg2.ProgrammingError: syntax error at or near "E'mytable'"
LINE 1: SELECT * FROM E'mytable' LIMIT 1

This may be similar to the problem that ASh had (http://
groups.google.com/group/comp.lang.python/browse_thread/thread/
7463ded0971425f8/538e60ba0ccf2ad3?#538e60ba0ccf2ad3)

I'd really appreciate any ideas.  At the moment, I'm stuck
concatenating strings and hoping for the best.



More information about the Python-list mailing list