Re: psycopg2 for insertion of binary data to PostgreSQL database

2010-08-23 Thread Graeme Glass
On Aug 23, 9:37 am, Julia Jacobson 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 recor

Re: psycopg2 for insertion of binary data to PostgreSQL database

2010-08-23 Thread Peter Otten
Julia Jacobson 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'",) To retrieve an image from a table "images" by its name you could do (unt

Re: psycopg2 for insertion of binary data to PostgreSQL database

2010-08-23 Thread Julia Jacobson
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 -- http://mail.python.org/mailman/li

Re: psycopg2 for insertion of binary data to PostgreSQL database

2010-08-22 Thread Thomas Jollans
On Sunday 22 August 2010, it occurred to Julia Jacobson to exclaim: > Thanks a lot, this was the solution. > It would be greate, if you could also show me a way to extract the > inserted binary object from the table on the server to a file on a client. Probably something along the lines of: * exe

Re: psycopg2 for insertion of binary data to PostgreSQL database

2010-08-22 Thread Julia Jacobson
Thanks a lot, this was the solution. It would be greate, if you could also show me a way to extract the inserted binary object from the table on the server to a file on a client. > Peter Otten wrote: Julia Jacobson wrote: Hello everybody out there using python, For the insertion of pictures

Re: psycopg2 for insertion of binary data to PostgreSQL database

2010-08-21 Thread Peter Otten
Julia Jacobson wrote: > Hello everybody out there using python, > > For the insertion of pictures into my PostgreSQL database [with table > foo created by SQL command "CREATE TABLE foo (bmp BYTEA)], I've written > the following script: > > #!/usr/bin/python > import psycopg2 > try: > conn =

Re: psycopg2 for insertion of binary data to PostgreSQL database

2010-08-21 Thread D'Arcy J.M. Cain
On Sat, 21 Aug 2010 22:58:00 +0200 Julia Jacobson wrote: > For the insertion of pictures into my PostgreSQL database [with table > foo created by SQL command "CREATE TABLE foo (bmp BYTEA)], I've written > the following script: > > #!/usr/bin/python > import psycopg2 > try: > conn = psycopg

psycopg2 for insertion of binary data to PostgreSQL database

2010-08-21 Thread Julia Jacobson
Hello everybody out there using python, For the insertion of pictures into my PostgreSQL database [with table foo created by SQL command "CREATE TABLE foo (bmp BYTEA)], I've written the following script: #!/usr/bin/python import psycopg2 try: conn = psycopg2.connect("dbname='postgres' use