Skip to content

Commit fe3a3d4

Browse files
committed
WIP new upsert implementation, refs #652
1 parent 55047db commit fe3a3d4

File tree

4 files changed

+195
-112
lines changed

4 files changed

+195
-112
lines changed

docs/python-api.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,13 @@ An ``upsert_all()`` method is also available, which behaves like ``insert_all()`
927927
.. note::
928928
``.upsert()`` and ``.upsert_all()`` in sqlite-utils 1.x worked like ``.insert(..., replace=True)`` and ``.insert_all(..., replace=True)`` do in 2.x. See `issue #66 <https://github.com/simonw/sqlite-utils/issues/66>`__ for details of this change.
929929

930+
.. _python_api_old_upsert:
931+
932+
Alternative upserts using INSERT OR IGNORE
933+
------------------------------------------
934+
935+
Upserts use ``INSERT INTO ... ON CONFLICT SET``. Prior to ``sqlite-utils 3.x`` (TODO: fill in version) these used a sequence of ``INSERT OR IGNORE`` followed by an ``UPDATE``. This older method is still used for SQLite 3.23.1 and earlier. You can force the older implementation by passing ``use_old_upsert=True`` to the ``Database()`` constructor.
936+
930937
.. _python_api_convert:
931938

932939
Converting data in columns

0 commit comments

Comments
 (0)