On Aug 23, 9:37 am, Julia Jacobson <julia.jacob...@arcor.de> wrote: > How can I assign the result of a SQL query to a variable? > The following code snippet doesn't work: > query_result=cur.execute("SELECT column_name FROM table_name WHERE > my_variable = 'my_value'",) > > > Thomas Jollans wrote: > > > > > * get the record you're interested in
You need to go and fetch the data now. query_result.fetchone() Take a look at the docs here, on how to fetch one vs many rows (fetchmany) http://initd.org/psycopg/docs/cursor.html#cursor.fetchone hth, Graeme -- http://mail.python.org/mailman/listinfo/python-list