Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Previewing bulk update SQL causes duplicate execution and affected-row counts

Abierto
#2,319 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@Fire162 ya está trabajando en esto.

Desde el 14/10/2026.

  • #2321 de @Fire162 — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
18/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python, sqlite
Área
database

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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de tortoise/tortoise-orm

Todos los issues de tortoise/tortoise-orm

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.