Hello,

I am using 'psycopg2' library to access my PostgreSQL database from a python. I 
want to pass a variable input in psql query something like this :- 

psql>>\set my_user table1
psql>>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 "<stdin>", line 1, in <module>
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

Reply via email to