tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.58k stars 378 forks source link

Error caused by % #1476

Open plusgua opened 1 year ago

plusgua commented 1 year ago
DEBUG:tortoise.db_client:UPDATE `order` SET `type`=%s WHERE `type`=17 AND (CAST(`result` AS CHAR) LIKE '%****%' OR CAST(`result` AS CHAR) LIKE '%----%'): [16]
ERROR:telethon.client.updates:Unhandled exception on handler
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/telethon/client/updates.py", line 570, in _dispatch_update
    await callback(event)
  File "x.py", line 615, in handler
    await query(event)
  File "x.py", line 306, in query
    await Order.filter(Q(type=17) & (Q(result__contains='****') | Q(result__contains='----'))).update(type=16)
  File "/usr/local/lib/python3.8/dist-packages/tortoise/queryset.py", line 1111, in _execute
    return (await self._db.execute_query(str(self.query), self.values))[0]
  File "/usr/local/lib/python3.8/dist-packages/tortoise/backends/mysql/client.py", line 44, in translate_exceptions_
    return await func(self, *args)
  File "/usr/local/lib/python3.8/dist-packages/tortoise/backends/mysql/client.py", line 199, in execute_query
    await cursor.execute(query, values)
  File "/usr/local/lib/python3.8/dist-packages/aiomysql/cursors.py", line 237, in execute
    query = query % self._escape_args(args, conn)

The initial suspicion is caused by contains, how can I solve this problem