MCPcopy
hub / github.com/tortoise/tortoise-orm / select_for_update

Method select_for_update

tortoise/models.py:1321–1337  ·  view source on GitHub ↗

Make QuerySet select for update. Returns a queryset that will lock rows until the end of the transaction, generating a SELECT ... FOR UPDATE SQL statement on supported databases.

(
        cls,
        nowait: bool = False,
        skip_locked: bool = False,
        of: tuple[str, ...] = (),
        using_db: BaseDBAsyncClient | None = None,
        no_key: bool = False,
    )

Source from the content-addressed store, hash-verified

1319
1320 @classmethod
1321 def select_for_update(
1322 cls,
1323 nowait: bool = False,
1324 skip_locked: bool = False,
1325 of: tuple[str, ...] = (),
1326 using_db: BaseDBAsyncClient | None = None,
1327 no_key: bool = False,
1328 ) -> QuerySet[Self]:
1329 """
1330 Make QuerySet select for update.
1331
1332 Returns a queryset that will lock rows until the end of the transaction,
1333 generating a SELECT ... FOR UPDATE SQL statement on supported databases.
1334 """
1335 return cls._db_queryset(using_db, for_write=True).select_for_update(
1336 nowait, skip_locked, of, no_key=no_key
1337 )
1338
1339 @classmethod
1340 async def update_or_create(

Callers 2

update_or_createMethod · 0.45
test_select_for_updateFunction · 0.45

Calls 1

_db_querysetMethod · 0.80

Tested by 1

test_select_for_updateFunction · 0.36