Skip to content

Commit

Permalink
Changelog for 1.1 + docs for --ignore/ignore=True
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed May 29, 2019
1 parent 50e2f94 commit 26b2cf3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 4 additions & 0 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
4 changes: 4 additions & 0 deletions docs/python-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
============

Expand Down Expand Up @@ -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
==============

Expand Down

0 comments on commit 26b2cf3

Please sign in to comment.