I welcome everyone, I have a column with an array and type Bigint, I tried to update the desired array but got an error, how can I do it right?
#My column
statistics = ArrayField(BigIntegerField, default=[0, 0, 0, 0, 0, 0])
#My try
await db.execute(MarriagePlayer.update({
MarriagePlayer.statistics[0]: MarriagePlayer.statistics[0] + 1
}).where(
MarriagePlayer.chat_id == msg.receiver_id,
MarriagePlayer.user_id << [msg.sender_id, p.loved]))
and my error:
MarriagePlayer.statistics[0]: MarriagePlayer.statistics[0] + 1
TypeError: unhashable type: 'ObjectSlice'
There was a missing method implementation which prevented slice expressions from being used as dict keys. This is now fixed in master:
https://github.com/coleifer/peewee/commit/7eb7498018b4265ce7e79c3e2b0b90a93d622d45
The fix will be included in the next release as well.