하나만 승리하고 나머지는 상대방이 락을 풀 때까지 기다려야 한다. 이 방식은 비관적 동시성
제어의 예라고 할 수 있다.
다음은
SQLAlchemy
DSL
에서 질의 시점에
SELECT
FOR
UPDATE
를 수행하는 방법을 보여
준다.
SQLAlchemy
의
with
_
for
_
update
(
src
/
allocation
/
adapters
/
repository
.
py
)
def get(self, sku):
return self.session.query(model.Product) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.