Open
Description
Python Version
3.10.11
Django Version
3.2.19
MariaDB/MySQL Version
Mysql 8.0.32
Package Version
4.11.0
Description
I hope to execute the "update" statement through "force_index", but the comment in the actual executed sql becomes "where 1", I'm not sure if this is normal behavior.
project settings
INSTALLED_APPS += (
...
"django_mysql"
)
...
DJANGO_MYSQL_REWRITE_QUERIES = True
...
class OperateRecordQuerySet(QuerySetMixin):
...
class OperateRecordModel(models.Model):
objects = OperateRecordModelManager().from_queryset(OperateRecordQuerySet)()
i try to use this orm code
class BusinessInfo(OperateRecordModel):
combined_id = models.CharField(
primary_key=True,
)
...
delete_filter = {self.pk_field + "__in": delete_combined_ids}
BusinessInfo.model.objects.force_index("PRIMARY").filter(**delete_filter).update(is_deleted=True)
but I watch the original sql
from django.db import connection
queries = connection.queries
logger.info(queries)
this is the result
UPDATE `xxx` SET `is_deleted` = 1 WHERE ((1) AND `xxx`.`combined_id` IN ('xxx'))
for other index name,these sqls are same
I don't know if this is a normal result, please help me to confirm, thanks
Metadata
Metadata
Assignees
Labels
No labels