Tarantool CE/EE Documentation portal logo
Support
Updated at July 17, 2026   02:08 PM

box.begin()

box.begin([opts])

Begin the transaction. Disable implicit yields until the transaction ends. Signal that writes to the write-ahead log will be deferred until the transaction ends. In effect the fiber which executes box.begin() is starting an "active multi-request transaction", blocking all other fibers.

Parameters:

  • opts (table) — (optional) transaction options:

  • txn_isolation – the transaction isolation level

  • timeout – a timeout (in seconds), after which the transaction is rolled back

Possible errors:

  • error if this operation is not permitted because there is already an active transaction.
  • error if for some reason memory cannot be allocated.
  • error and abort the transaction if the timeout is exceeded.

Example

-- Insert test data --box.space.bands:insert { 1, 'Roxette', 1986 }box.space.bands:insert { 2, 'Scorpions', 1965 }box.space.bands:insert { 3, 'Ace of Base', 1987 }-- Begin and commit the transaction explicitly --box.begin()box.space.bands:insert { 4, 'The Beatles', 1960 }box.space.bands:replace { 1, 'Pink Floyd', 1965 }box.commit()-- Begin the transaction with the specified isolation level --box.begin({ txn_isolation = 'read-committed' })box.space.bands:insert { 5, 'The Rolling Stones', 1962 }box.space.bands:replace { 1, 'The Doors', 1965 }box.commit()