Previewing bulk update SQL causes duplicate execution and affected-row counts
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 18/100
Línea de trabajo
Start from the bulk_update query and the sql() preview path, and check how the preview adds batches to the persistent query buffer that awaiting the query reads from. Run the snippet in the issue against in-memory SQLite to confirm the row count is 4 instead of 2. Linked pull request #2321 is already open against this bug, so review or build on that work rather than starting a separate fix. Done means preview leaves execution unchanged and repeated sql() calls return no duplicate statements.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
On current develop ac38923, previewing a bulk update with sql() adds its batches to a persistent query buffer. Awaiting the same query appends them again, so two rows are updated twice and the affected-row count becomes four. Repeated sql() calls also return duplicate statements.
objects = [await Tournament.create(name="old") for _ in range(2)]
for obj in objects:
obj.name = "new"
query = Tournament.bulk_update(objects, fields=["name"])
print(query.sql())
print(await query)
# 4, while the same call without the SQL preview returns 2
I expected SQL preview to leave execution unchanged. Reproduced with the repository Tournament test model and SQLite in memory on Ubuntu with Python 3.14.6.
This uses reusable lists and is separate from the iterator problem in #2317.
- Lenguaje dominante
- Python
- Estrellas
- 5.6k
- Forks
- 523
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 12
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tortoise/tortoise-orm
-
pydantic_model_creator returns a cached class that ignores model_config, validators and modulePosiblemente ocupada @moneebullah25 la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
tortoise/tortoise-orm#2310 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
tortoise/tortoise-orm#668 ·
Los mantenedores suelen responder en 2 días
-
refresh_from_db silently ignores fields supplied as an iteratorPosiblemente ocupada @IlyaKhalafi la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
tortoise/tortoise-orm#2341 ·
Los mantenedores suelen responder en 2 días
-
Renamed fields break dict(model) and default values_listPosiblemente ocupada @IlyaKhalafi la tomó hace 1 día. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
tortoise/tortoise-orm#2337 ·
Los mantenedores suelen responder en 2 días
-
Reverse relation filters use attribute names for SQL columnsPosiblemente ocupada @IlyaKhalafi la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
tortoise/tortoise-orm#2336 ·
Los mantenedores suelen responder en 2 días
Todos los issues de tortoise/tortoise-orm
Issues similares
-
bot-triaged module: LrScheduler module: optimizer triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
documentation glm5 llm-model
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
vllm-project/vllm-ascend#19062 ·
Los mantenedores suelen responder en 1 día
-
Author Page: shuai-zhao-llmAbiertoauthor-page correction
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
acl-org/acl-anthology#10496 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Issue Type: Bug Report
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
celery/celery#10875 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
SasanLabs/VulnerableApp#836 ·
Los mantenedores suelen responder en 1 día