Introduction
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.
Requirements
Python >= 2.6 (tested on 2.7 and 3.6)
Django >= 1.7
PostgreSQL >= 9.5
Installation
Running following command:
$ python setup.py install
Or using pip:
$ pip install -U django-postgres-ioc
Usage
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()
Test.objects.create_or_update(
conflict="code",
code="luojilab",
defaults={
"name": "LuojiLab",
},
)
Metadata
Release files for django-postgres-ioc 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_postgres_ioc-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for django_postgres_ioc-0.0.2-py3-none-any.whl |
Release files / django_postgres_ioc-0.0.2-py3-none-any.whl
| Download URL | django_postgres_ioc-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e127ccbbf6d475ba0eed8f209402e54ea897d060d79a4977cc652a00f44a26b
|
|
BLAKE2b-256 checksum How to use checksums |
275dc16d9f23311d1dd53561e49356596491769ec4649f5df1a3b43bbb6e6c27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-postgres-ioc 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.