mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
docs: clarify insert() commit behavior in API reference
This commit is contained in:
parent
8d74ffc932
commit
b330cf6d92
1 changed files with 6 additions and 0 deletions
|
|
@ -528,6 +528,12 @@ You can also specify a primary key by passing the ``pk=`` parameter to the ``.in
|
|||
|
||||
After inserting a row like this, the ``dogs.last_rowid`` property will return the SQLite ``rowid`` assigned to the most recently inserted record.
|
||||
|
||||
.. note::
|
||||
|
||||
``.insert()`` and ``.insert_all()`` commit writes in batches (``.insert()`` writes one-row batches).
|
||||
If you are manually controlling transactions using a SQLite connection context manager, calling these methods
|
||||
may commit earlier than expected.
|
||||
|
||||
The ``dogs.last_pk`` property will return the last inserted primary key value, if you specified one. This can be very useful when writing code that creates foreign keys or many-to-many relationships.
|
||||
|
||||
.. _python_api_custom_columns:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue