【问题标题】:psycopg2 "select for update"psycopg2“选择更新”
【发布时间】:2018-07-18 16:58:01
【问题描述】:

我正在使用 psycopg2 将 Postgresql 与 Python 结合使用,但我不确定如何获取“选择更新”查询来使用它。除了 psycopg2,我还可以使用其他东西。如何使用 Python 创建用于更新查询的 postgresql 选择?

【问题讨论】:

    标签: python psycopg2 select-for-update


    【解决方案1】:

    psycopg2 只是执行您发送到执行方法的字符串中的 sql。您只需像在其他任何地方一样在查询中添加 select for update 即可。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      • 2021-02-28
      • 2021-06-11
      • 1970-01-01
      • 2012-04-09
      • 2016-07-28
      • 1970-01-01
      相关资源
      最近更新 更多