django-native-postgres
Native asynchronous PostgreSQL execution for Django, powered by Rust, Tokio,
and tokio-postgres.
What this project does
django-native-postgres keeps Django's ORM, models, query construction, SQL
compiler, relations, and model creation. Compiled SQL is handed to this
backend, which performs the database I/O asynchronously without moving that
I/O into a sync_to_async() worker thread.
Django async ORM
|
v
Django SQL compiler
|
v
django-native-postgres (Python)
|
v
PyO3 -> Tokio -> Rust-owned PostgreSQL pool
|
v
PostgreSQL
This is a PostgreSQL backend for Django. It is not a replacement ORM.
Current capabilities
The project integration suite currently covers:
- async queryset reads, iteration, values, aggregates, and raw queries;
- async creates, updates, deletes, bulk operations, and model methods;
- related managers, prefetching, generic relations, and content types;
- native async transactions, nested savepoints, rollback state, and
on_commit()callbacks; - transaction isolation, read-only, and deferrable options;
- Rust-owned connection pooling with bounded concurrency and acquisition timeouts;
- cancellation of active and pool-waiting queries;
- runtime and pool recreation after POSIX
fork(), with inherited transaction handles rejected.
See Compatibility for the exact tested surface and current limitations.
Current limitations
Native async execution works for the ORM operations covered by the integration suite, but the project still has the following release limitations:
- The native async ORM contract exists only in the project's Django fork.
- Query parameters currently support only strings, integers, and
None. - Result decoding currently supports text and integer PostgreSQL types.
- Async iteration is exposed in chunks, but Rust currently buffers the entire result before the first chunk reaches Django.
- Native PostgreSQL connections currently use
NoTls. - The project has not yet completed Django's PostgreSQL compatibility suite or a supported platform and PostgreSQL version matrix.
Unsupported native PostgreSQL result types fail explicitly. The Django fork still preserves compatibility fallbacks for backends and custom ORM paths that do not use the native async contract.
Development quick start
The current version must be used with the exact tested Django fork. Install the fork and this package in the same command so the dependency resolver uses the required Django distribution:
python -m pip install \
"Django @ git+https://github.com/p-r-a-v-i-n/django.git@312860d0e58e0d54fef10bae7ecf63f537723d17" \
django-native-postgres
The package metadata requires the fork's exact generated Django version. A plain installation without the fork therefore fails instead of silently using an incompatible upstream Django release. See Django fork requirement for details.
Requirements:
- Python 3.12 or newer;
- Rust 1.99 or newer;
uv;just; and- Docker or another Docker-compatible container runtime for PostgreSQL integration tests.
Create the environment and build the native extension:
just setup
Configure the backend through Django's normal DATABASES setting:
DATABASES = {
"default": {
"ENGINE": "django_native_postgres",
"NAME": "application",
"USER": "application",
"PASSWORD": "secret",
"HOST": "127.0.0.1",
"PORT": "5432",
"OPTIONS": {
"native_pool": {
"max_size": 16,
"wait_timeout_ms": 30_000,
},
},
}
}
Supported Django async ORM calls then use the native backend path:
from your_app.models import Book
async def find_book(book_id):
return await Book.objects.aget(pk=book_id)
The complete configuration surface is described in Configuration.
Run formatting, linting, Rust checks, and tests that do not require a live PostgreSQL server:
just check
Run the PostgreSQL integration suite:
just test-postgres
Run one PostgreSQL test:
just test-postgres tests/test_postgres_execution.py::test_name
The test database configuration and other development commands are described in Development.
Documentation
Start with the documentation index. Important references are:
- Architecture
- Django fork requirement
- Connection pool design
- Supported PostgreSQL values
- Compatibility and limitations
License
Licensed under the BSD 3-Clause License. See LICENSE.
Metadata
Release files for django-native-postgres 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_native_postgres-0.1.0.tar.gz | 84.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| django_native_postgres-0.1.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| django_native_postgres-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| django_native_postgres-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| django_native_postgres-0.1.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
| django_native_postgres-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 4.8 MB
Release files / django_native_postgres-0.1.0.tar.gz
| Download URL | django_native_postgres-0.1.0.tar.gz |
|---|---|
| Size | 84.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38ebc71033a299c0cf881c12a00963118b9bc4acd687c179efe25eb44b26c86c
|
|
BLAKE2b-256 checksum How to use checksums |
b163d369629b29856c52a25f197c4319ac1bcb9d121d546c042a6ad265e7ceb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / django_native_postgres-0.1.0-cp312-abi3-win_amd64.whl
| Download URL | django_native_postgres-0.1.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 813.2 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2a554c258dec3f966c10a8cabe0ed55efc2f765c695dac0c997c03cc750dde02
|
|
BLAKE2b-256 checksum How to use checksums |
067633deede320aff78727394f591ef356e7f21fd93ac7d1aea6022da0378bdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / django_native_postgres-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | django_native_postgres-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7d28b8dbb4d00497cbc18633e77354f92b71b99cde741f81bd24853a4858bdcc
|
|
BLAKE2b-256 checksum How to use checksums |
41da83aa6ba45f365a7bc979ebc319e18277fada7631dc63ef1a2212c2ab24b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / django_native_postgres-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | django_native_postgres-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
4686607fbd6db4e8913000d201f8e4af73e4da77bffd0ee2c2e58f7ffbe85620
|
|
BLAKE2b-256 checksum How to use checksums |
d4ecfd9226e29da563257155941b02806f4495e6ad89aab8829e9f4ebcc85be7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / django_native_postgres-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | django_native_postgres-0.1.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 902.3 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fe56081f231db084904eb8b149d9ab3b082a603f0dec1cae13bb9f4908daff0b
|
|
BLAKE2b-256 checksum How to use checksums |
cb2000b85453fb0c4e51b0b5058dc325ee618e74e6c261cbe948b39cf3467673
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / django_native_postgres-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | django_native_postgres-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 938.3 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
513fe22366f8cb4e87082654d2c3c9fa19d5017eda882c9cc5e29c4ca51ac297
|
|
BLAKE2b-256 checksum How to use checksums |
ee0dbf0f271ca5f4688f4ce6c77f1648a77b3ea1023aacc88988aad83cf8da6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency log