Here is my code:
currSrc = connSrc.cursor()
currSrc.execute("""SELECT request_id, time_beg, shape FROM "REQUESTS" WHERE fl_ready=1""")
shape
have type blob (bytea). I need to save it's on FS. How can I do it with Python?
Here is my code:
currSrc = connSrc.cursor()
currSrc.execute("""SELECT request_id, time_beg, shape FROM "REQUESTS" WHERE fl_ready=1""")
shape
have type blob (bytea). I need to save it's on FS. How can I do it with Python?
Just write it to the disk:
currSrc.execute("""
SELECT request_id, time_beg, shape
FROM "REQUESTS"
WHERE fl_ready=1
""")
rs = cursor.fetchall()
f = open('/path/to/the/file', 'wb')
f.write(rs[0][2])
f.close()
The reason for the [0][2]
is that it is the first line of the result set and the third column.