Missing Bulk Operation (ARCH2053)
هذا المحتوى غير متوفر بلغتك بعد.
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.
Incorrect
Section titled “Incorrect”for name in names: Tag.objects.create(name=name) # a separate INSERT per nameCorrect
Section titled “Correct”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.