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

2010-04-05 Thread mrdrew
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

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

2010-04-02 Thread Steve Holden
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

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

2010-04-02 Thread Tim Chase
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

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

2010-04-02 Thread MRAB
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

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

2010-04-02 Thread mrdrew
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): Fi