Skip to main content

Native postgres bulk update and upsert operations.

Project description

django-pgbulk, forked from django-manager-utils, provides several optimized bulk operations for Postgres:

  1. update - For updating a list of models in bulk. Although Django provides a bulk_update in 2.2, it performs individual updates for every row and does not perform a native bulk update.

  2. upsert - For doing a bulk update or insert. This function uses postgres UPDATE ON CONFLICT syntax to perform an atomic upsert operation. There are several options to this function that allow the user to avoid touching rows if they result in a duplicate update, along with returning which rows were updated, created, or untouched. Users can also use models.F objects on conflicts.

  3. sync - For syncing a list of models with a table. Does a bulk upsert and also deletes any rows in the source queryset that were not part of the input data.

For more examples, see the django-pgbulk docs.

Documentation

View the django-pgbulk docs here.

Installation

Install django-pgbulk with:

pip3 install django-pgbulk

After this, add pgbulk to the INSTALLED_APPS setting of your Django project.

Contributing Guide

For information on setting up django-pgbulk for development and contributing changes, view CONTRIBUTING.rst.

Primary Authors

  • @wesleykendall (Wes Kendall)

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-pgbulk-1.3.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

django_pgbulk-1.3.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file django-pgbulk-1.3.0.tar.gz.

File metadata

  • Download URL: django-pgbulk-1.3.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.6 Linux/5.15.0-1021-aws

File hashes

Hashes for django-pgbulk-1.3.0.tar.gz
Algorithm Hash digest
SHA256 01530b1708441c834450308e10929eca0d6231747d7df2661069e93c61837446
MD5 d8072e55c356004b4e2f4c0b0a4d2caa
BLAKE2b-256 a781f57597a1511c321e6cc7999c1d744add139988910a2d3558f73e5850c6d1

See more details on using hashes here.

File details

Details for the file django_pgbulk-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: django_pgbulk-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.6 Linux/5.15.0-1021-aws

File hashes

Hashes for django_pgbulk-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81c9b03a62160b93ff2313d8065ec9725b35c14781d84a3bf8eea5b60443bdc3
MD5 07f5a066a2a2f8e5cf574501c6340734
BLAKE2b-256 fe2854a873b552b9396f3bae820555ec622dc1de5b613f1436b2374fc97a13bd

See more details on using hashes here.

Supported by

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