Arya
Arya

Reputation: 8995

psycopg2 "select for update"

I'm using psycopg2 for using Postgresql with Python, but I am not sure how to get a "select for update" query to work with it. I can also use something besides psycopg2. How can a postgresql select for update query be created with Python?

Upvotes: 3

Views: 1323

Answers (1)

Michael Robellard
Michael Robellard

Reputation: 2358

psycopg2 is just executing the sql in the string that you send to the execute method. you just put select for update in your query like you would anywhere else.

cursor.execute("""select * from some_table for update""")

Upvotes: 2

Related Questions