sqlite-utils bulk --batch-size option, closes #392

This commit is contained in:
Simon Willison 2022-01-26 10:15:23 -08:00
commit d1d2a8e6fa
4 changed files with 54 additions and 4 deletions

View file

@ -309,6 +309,7 @@ See :ref:`cli_bulk`.
' -
Options:
--batch-size INTEGER Commit every X records
--flatten Flatten nested JSON objects, so {"a": {"b": 1}} becomes
{"a_b": 1}
--nl Expect newline-delimited JSON

View file

@ -1120,6 +1120,8 @@ You could insert those rows into a pre-created ``chickens`` table like so::
This command takes the same options as the ``sqlite-utils insert`` command - so it defaults to expecting JSON but can accept other formats using ``--csv`` or ``--tsv`` or ``--nl`` or other options described above.
By default all of the SQL queries will be executed in a single transaction. To commit every 20 records, use ``--batch-size 20``.
.. _cli_insert_files:
Inserting data from files