Zum Inhalt springen

Missing Bulk Operation (ARCH2053)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key python.orm.missing-bulk-operation · Severity warning · Category orm

Calling create() one row at a time in a loop produces needless round-trips when a bulk API like bulk_create exists. Collapse it to a single bulk call.

for name in names:
Tag.objects.create(name=name) # a separate INSERT per name
Tag.objects.bulk_create([Tag(name=name) for name in names])

Replace repeated single-row writes with a bulk API such as bulk_create / bulk_update.