Re: psycopg2.ProgrammingError: syntax error at or near "\"

2017-10-27 Thread Karsten Hilbert
l>>select * from :my_user limit 10; > > So I am just running these sql commands and getting this error :- > > >>> cur.execute("""\set my_user table1""") > Traceback (most recent call last): > File "", line 1, in > ps

psycopg2.ProgrammingError: syntax error at or near "\"

2017-10-27 Thread maheshyadav1771
and getting this error :- >>> cur.execute("""\set my_user table1""") Traceback (most recent call last): File "", line 1, in psycopg2.ProgrammingError: syntax error at or near "\" LINE 1: \set my_user table1 Can anyone please help me out here. Thanks, Vipul -- https://mail.python.org/mailman/listinfo/python-list

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'&q

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

2010-04-02 Thread Steve Holden
"mytable"}) > > It fails, giving the error message... > > Traceback (most recent call last): > File "test.py", line 7, in > c.execute('SELECT * FROM %(table_name)s LIMIT 1', > {'table_name':"mytable"}) > psycopg2.ProgrammingE

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

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

2010-04-02 Thread mrdrew
age... Traceback (most recent call last): File "test.py", line 7, in 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