-
Notifications
You must be signed in to change notification settings - Fork 3
Description
🚀 Feature Request: Implement Bulk Update in BaseRepository
Description
Currently, BaseRepository supports individual updates via the update(obj_id, data) method. However, bulk updates are not supported, which can be inefficient for updating multiple records at once.
Proposed Solution
Add a method bulk_update(self, updates: List[dict], key_field: str = "id") to allow updating multiple objects in a single query.
Expected Behavior
• Accepts a list of dictionaries, where each dictionary contains the primary key (id or key_field) and the fields to update.
• Uses Django’s bulk_update() to update records efficiently.
Alternatives Considered
• Using multiple .update() calls inside a loop (inefficient).
• Using raw SQL queries (not Django ORM friendly).
Impact
✅ Reduces database queries significantly for batch updates.
✅ Improves performance in high-load applications.
✅ Keeps repository logic clean and efficient.
Looking forward to feedback and suggestions! 🚀