تخطَّ إلى المحتوى

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.

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.