karlxu
V2EX  ›  问与答

Python 里操作 MySQL 怎么锁表的一行?

  •  
  •   karlxu · Jan 8, 2016 · 2978 views
    This topic created in 3870 days ago, the information mentioned may be changed or developed.
    有个 Python 脚本在 2 台机器上运行,有可能会同时访问到一张表的某一行数据,所以想着当一台机器访问到那一行的数据先锁住,但不知道代码里怎么写....
    2 replies    2016-01-08 15:31:09 +08:00
    yuanji
        1
    yuanji  
       Jan 8, 2016
    SQL 还是一样写吧。
    select for update?
    wshcdr
        2
    wshcdr  
       Jan 8, 2016   ❤️ 1
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3797 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 10:22 · PVG 18:22 · LAX 03:22 · JFK 06:22
    ♥ Do have faith in what you're doing.