Skip to main content

A Django model manager providing insert on conflict for PostgreSQL database tables.

Project description


Django ORM manager for Postgresql Came from Rock@luojilab

Replace update_or_create Without transaction, when using update_or_create may raise IntegrityError Because thread 1 execute update affect 0 row and at the same time, thread 2 insert it then thread 1 do insert will trigger UniqueKey conflict.

This method will use INSERT ON CONFLICT feature to fix this.


  • Python >= 2.6 (tested on 2.7 and 3.6)
  • Django >= 1.7
  • PostgreSQL >= 9.5


Running following command:

$ python install

Or using pip:

$ pip install -U django-postgres-ioc


Python code:

from django.db import models
from ioc import IOCManager

class Test(models.Model):
    code = models.CharField(max_length=50, unique=True))
    name = models.CharField(max_length=100

    objects = IOCManager()

        "name": "LuojiLab",

Project details

Download files

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

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page