-------
Added the ``on_conflict`` clause for ``insert`` queries. This enables **upserts**.
For example, here we insert some bands, and if they already exist then do
nothing:
.. code-block:: python
await Band.insert(
Band(name='Pythonistas'),
Band(name='Rustaceans'),
Band(name='C-Sharps'),
).on_conflict(action='DO NOTHING')
Here we insert some albums, and if they already exist then we update the price:
.. code-block:: python
await Album.insert(
Album(title='OK Computer', price=10.49),
Album(title='Kid A', price=9.99),
Album(title='The Bends', price=9.49),
).on_conflict(
action='DO UPDATE',
target=Album.title,
values=[Album.price]
)
Thanks to sinisaos for helping with this.
-------------------------------------------------------------------------------