Skip to main content

Save multiple model instances using one SQL query.

Project description

Django Bulk Saving

Test package Coverage Status

About

This package provides utility for saving multiple Django model instances using one SQL query.

Install

pip install django-bulk-saving

Usage

Inherit from BulkSavableModel:

from bulk_saving.models import BulkSavableModel
from django.db import models


class Product(BulkSavableModel):
    name = models.CharField(max_length=30)

Use as follows:

with Product.bulk_saving():
    for idx, product in enumerate(Product.objects.all(), 1):
        product.name = 'Product nr %s' % idx
        product.save_later()

Products will be saved after exit from context.

License

The Django Wicked Historian package is licensed under the FreeBSD License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-bulk-saving-1.0.0.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

django_bulk_saving-1.0.0-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page