Based on this discussion: #248
We don't currently have an API for upserting.
This would be based around the ON CONFLICT clause you can add to INSERT queries.
https://www.postgresql.org/docs/current/sql-insert.html#SQL-ON-CONFLICT
There will probably be two APIs needed. Something for insert queries, and a convenience method for objects queries.
For example:
# For insert
Band.insert(Band(name='Pythonistas')).on_conflict(...).run_sync()
# For objects
Band.objects().upsert(Band.name == 'Pythonistas', {Band.popularity: 5000}).run_sync()
Based on this discussion: #248
We don't currently have an API for upserting.
This would be based around the
ON CONFLICTclause you can add toINSERTqueries.https://www.postgresql.org/docs/current/sql-insert.html#SQL-ON-CONFLICT
There will probably be two APIs needed. Something for
insertqueries, and a convenience method forobjectsqueries.For example: