SQL get data out of BEGIN; ...; END; block in python
Posted
by Claudiu
on Stack Overflow
See other posts from Stack Overflow
or by Claudiu
Published on 2010-06-08T23:17:18Z
Indexed on
2010/06/08
23:22 UTC
Read the original article
Hit count: 294
I want to run many select queries at once by putting them between BEGIN;
END;
. I tried the following:
cur = connection.cursor()
cur.execute("""
BEGIN;
SELECT ...;
END;""")
res = cur.fetchall()
However, I get the error:
psycopg2.ProgrammingError: no results to fetch
How can I actually get data this way?
Likewise, if I just have many selects in a row, I only get data back from the latest one. Is there a way to get data out of all of them?
© Stack Overflow or respective owner