I would like to update a text field in an sqlite database created using the peewee python library. Specifically I would like to use peewee's atomic updates something like:
query = Table.update(textfield = Table.textfield + 'string').where(some condition)
query.execute()
This type of update works fine for numeric fields but not for text fields. I'm guessing there may be a way to do this with the sqlite || operator, but as sql in general is somewhat new to me I am unable to figure it out.
You can use the concat operator:
query = Table.update(textfield=Table.textfield.concat('string')).where(whatever)
query.execute()
The concat
operator will use ||
under-the-hood.