# Locking the entire table

**URL:** https://discuss.tryton.org/t/locking-the-entire-table/4044
**Category:** Developer
**Created:** [April 12, 2021, 11:53am UTC](https://discuss.tryton.org/t/locking-the-entire-table/4044 "2021-04-12T11:53:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bell](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/b/c67d28/32.png) [@bell](https://discuss.tryton.org/u/bell)
#### Post date: [April 12, 2021, 11:53am UTC](https://discuss.tryton.org/t/locking-the-entire-table/4044/1 "2021-04-12T11:53:54Z")

</div>

Method `ModelSQL.lock(records)` take a lock on the records.  
Is it possible to lock the entire table?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [April 12, 2021, 12:07pm UTC](https://discuss.tryton.org/t/locking-the-entire-table/4044/2 "2021-04-12T12:07:25Z")

</div>

You must use `Database.lock` but indeed I guess `ModelSQL.lock` could be extended to lock the all table if no records is given ([Allow lock all table with ModelSQL.lock (#10273) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue10273)).

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [May 12, 2021, 12:07pm UTC](https://discuss.tryton.org/t/locking-the-entire-table/4044/3 "2021-05-12T12:07:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
