mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-08-01 23:14:12 +02:00
Changelog for 1.1 + docs for --ignore/ignore=True
This commit is contained in:
parent
50e2f94b58
commit
26b2cf3418
3 changed files with 15 additions and 0 deletions
|
|
@ -2,6 +2,13 @@
|
|||
Changelog
|
||||
===========
|
||||
|
||||
.. _v1_1:
|
||||
|
||||
1.1 (2019-05-28)
|
||||
----------------
|
||||
|
||||
- Support for ``ignore=True`` / ``--ignore`` for ignoring inserted records if the primary key alread exists (`#21 <https://github.com/simonw/sqlite-utils/issues/21>`__) - documentation: :ref:`Inserting data (Python API) <python_api_bulk_inserts>`, :ref:`Inserting data (CLI) <cli_inserting_data>`
|
||||
- Ability to add a column that is a foreign key reference using ``fk=...`` / ``--fk`` (`#16 <https://github.com/simonw/sqlite-utils/issues/16>`__) - documentation: :ref:`Adding columns (Python API) <python_api_add_column>`, :ref:`Adding columns (CLI) <cli_add_column>`
|
||||
|
||||
.. _v1_0_1:
|
||||
|
||||
|
|
|
|||
|
|
@ -224,6 +224,10 @@ You can import all three records into an automatically created ``dogs`` table an
|
|||
|
||||
$ sqlite-utils insert dogs.db dogs dogs.json --pk=id
|
||||
|
||||
You can skip inserting any records that have a primary key that already exists using ``--ignore``::
|
||||
|
||||
$ sqlite-utils insert dogs.db dogs dogs.json --ignore
|
||||
|
||||
You can also import newline-delimited JSON using the ``--nl`` option. Since `Datasette <https://datasette.readthedocs.io/>`__ can export newline-delimited JSON, you can combine the two tools like so::
|
||||
|
||||
$ curl -L "https://latest.datasette.io/fixtures/facetable.json?_shape=array&_nl=on" \
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ The ``foreign_keys`` argument takes a sequence of three-tuples, each one specify
|
|||
("author_id", "authors", "id")
|
||||
])
|
||||
|
||||
.. _python_api_bulk_inserts:
|
||||
|
||||
Bulk inserts
|
||||
============
|
||||
|
||||
|
|
@ -198,6 +200,8 @@ The function can accept an iterator or generator of rows and will commit them ac
|
|||
"name": "Name {}".format(i),
|
||||
} for i in range(10000)), batch_size=1000)
|
||||
|
||||
You can skip inserting any records that have a primary key that already exists using ``ignore=True``. This works with both ``.insert({...}, ignore=True)`` and ``.insert_all([...], ignore=True)``.
|
||||
|
||||
Upserting data
|
||||
==============
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue