> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# lock_table

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/lock_table.rs#L30-L37)
pub async fn [lock\_table](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/lock-table.md#method.lock_table)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), lock\_type: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[LockTableResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.LockTableResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Set read or write locks on a tableManages global access to a table’s data. By default a table has a `lock_type` of read\_write, indicating all operations are permitted. A user may request a read\_only or a write\_only lock, after which only read or write operations, respectively, are permitted on the table until the lock is removed. When `lock_type` is no\_access then no operations are permitted on the table. The lock status can be queried by setting `lock_type` to status.

##### Arguments

<ul>
  <li>`table_name` - Name of the table to be locked, in \[schema\_name.]table\_name format, using standard name resolution rules. It must be a currently existing table or view.</li>
  <li>`lock_type` - The type of lock being applied to the table. Setting it to status will return the current lock status of the table without changing it.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/lock_table.rs#L59-L77)
pub async fn [lock\_table\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/lock-table.md#method.lock_table_with_opts)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), lock\_type: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), options: [LockTableRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.LockTableRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[LockTableResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.LockTableResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Set read or write locks on a tableManages global access to a table’s data. By default a table has a `lock_type` of read\_write, indicating all operations are permitted. A user may request a read\_only or a write\_only lock, after which only read or write operations, respectively, are permitted on the table until the lock is removed. When `lock_type` is no\_access then no operations are permitted on the table. The lock status can be queried by setting `lock_type` to status.

##### Arguments

<ul>
  <li>`table_name` - Name of the table to be locked, in \[schema\_name.]table\_name format, using standard name resolution rules. It must be a currently existing table or view.</li>
  <li>`lock_type` - The type of lock being applied to the table. Setting it to status will return the current lock status of the table without changing it.</li>
  <li>`options` - The optional parameters; any left unset take the server’s defaults.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/lock_table.rs#L80-L91)
pub async fn [lock\_table\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/lock-table.md#method.lock_table_raw)( \&self, request: &[LockTableRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.LockTableRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[LockTableResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.LockTableResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`LockTableRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.LockTableRequest) to the `/lock/table` endpoint.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/lock_table.rs#L95-L107)
pub async fn [lock\_table\_from\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/lock-table.md#method.lock_table_from_url)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), request: &[LockTableRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.LockTableRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[LockTableResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.LockTableResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`LockTableRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.LockTableRequest) to a specific worker URL, bypassing HA head-node selection. Used for multi-head access.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.