Psycopg2中的"select for update"

3

我正在使用psycopg2在Python中使用Postgresql,但我不确定如何使用它来获取“select for update”查询。我也可以使用除了psycopg2之外的其他东西。如何使用Python创建一个postgresql select for update查询?

1个回答

2

psycopg2只是执行您发送到execute方法的字符串中的SQL。您只需像在任何其他地方一样在查询中放置“select for update”即可。

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接