Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 psycopg2 将 Postgresql 与 Python 一起使用,但我不确定如何获得“选择更新”查询来使用它。除了 psycopg2,我还可以使用其他东西。如何使用 Python 创建用于更新查询的 postgresql 选择?
psycopg2 只是执行您发送到执行方法的字符串中的 sql。您只需将 select for update 放入查询中,就像在其他任何地方一样。
cursor.execute("""select * from some_table for update""")