SQLAlchemy and explicit locking

后端 未结 1 623
攒了一身酷
攒了一身酷 2021-01-02 02:52

I have multiple processes that can potentially insert duplicate rows into the database. These inserts do not happen very frequently (a few times every hour) so it is not per

相关标签:
1条回答
  • 2021-01-02 03:21

    Pehaps this might be of interest to you:

    https://groups.google.com/forum/?fromgroups=#!topic/sqlalchemy/8WLhbsp2nls

    You can lock the tables by executing the SQL directly. I'm not sure what that looks like in Elixir, but in plain SA it'd be something like:

     conn = engine.connect()
     conn.execute("LOCK TABLES Pointer WRITE")
     #do stuff with conn
     conn.execute("UNLOCK TABLES")
    

    0 讨论(0)
提交回复
热议问题