psycopg2 for insertion of binary data to PostgreSQL database

Graeme Glass graemeglass at
Mon Aug 23 10:42:23 CEST 2010

On Aug 23, 9:37 am, Julia Jacobson <julia.jacob... at> 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.


Take a look at the docs here, on how to fetch one vs many rows


More information about the Python-list mailing list