Skip to content

Eliminate usage of bulk_create() and bulk_update() methods outside of tests and migrations #10694

Closed
@jeremystretch

Description

@jeremystretch

Proposed Changes

While we've generally avoided the use of bulk_create() and bulk_update() for the bulk creation and manipulation of objects due to the caveats associated with their use (namely not triggering the post_save signal), they are still used in a few areas within NetBox. The goal of this issue is to eliminate any usage of these methods, excluding within tests and migrations where specifically needed to ensure optimal performance.

Justification

As calling bulk_create() or bulk_update() does not generate a post_save signal for each of the objects affected, this escapes change logging and (in NetBox v3.4) search indexing. Although calling save() on each instance individual will impose a performance penalty, it ensures that each instance is subject to the appropriate background workflows. (This was initially called out here by @kkthxbye-code.)

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: housekeepingChanges to the application which do not directly impact the end user

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions