[Django]-“select_for_update” called inside an atomic block still TransactionManagementError

11👍

Are you using DBRouters by any chance? I had trouble with this – trick was to define the DB on the transaction AND select_for_update

with transaction.atomic(using='db_x'):
    order = Order.objects.using('db_x').select_for_update().get(id=o_id)
👤brettm

Leave a comment