Thanks for the replies. The param style is pyformat. I've tried
using the '%s' style with a set and get exactly the same error.
c.execute('SELECT * FROM %s LIMIT 1',('mytable',))
psycopg2.ProgrammingError: syntax error at or near "E'mytable'"
LINE 1: SELECT * FROM E'mytable' LIMIT 1
MRAB and St
mrdrew wrote:
> 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...
>
> Tra
MRAB wrote:
I think that you're confusing Python's string formatting with
SQL placeholders.
The "%(table_name)s" works only with Python's '%' operator.
You should use only the "%s" form (or possibly "?", I'm not
sure which!)
It varies depending on your DB driver. Check out the .paramstyle
mrdrew wrote:
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