box.commit()
-
box.
commit
()¶ End the transaction, and make all its data-change operations permanent.
Possible errors:
- error and abort the transaction in case of a conflict.
- error if the operation fails to write to disk.
- error if for some reason memory cannot be allocated.
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()