This release is a pre-release and may not be stable for production use.
django-ydb-backend
A Django database backend for YDB, a distributed SQL database. It lets Django applications use YDB through the standard ORM — models, migrations, queries, relations, and the contrib apps.
Documentation · PyPI · YDB · Issues
Features
- Django ORM for CRUD, relations, and the standard contrib apps (admin, auth, sessions)
- Most built-in Django field types
- Migrations with YDB-specific adaptations
- Native, race-free
UPSERTviaYDBManager - Multiple authentication methods (anonymous, static, access token, service account)
Quick start
Install:
pip install django-ydb-backend
To develop against a local database, start YDB in Docker:
docker run -d --name ydb-local --hostname localhost \
-p 2136:2136 -p 8765:8765 \
-e YDB_USE_IN_MEMORY_PDISKS=true \
ydbplatform/local-ydb:latest
This serves a ready-to-use database at /local on localhost:2136 — the values
used below. Then point a Django database at YDB in settings.py:
DATABASES = {
"default": {
"ENGINE": "ydb_backend.backend",
"NAME": "ydb_db",
"HOST": "localhost",
"PORT": "2136",
"DATABASE": "/local",
}
}
Define a model, migrate, and query as usual:
from django.db import models
class Product(models.Model):
sku = models.CharField(max_length=20, primary_key=True)
name = models.CharField(max_length=100)
price = models.IntegerField()
python manage.py makemigrations
python manage.py migrate
Product.objects.create(sku="A1", name="Widget", price=9)
Product.objects.filter(price__lt=10)
See the documentation for configuration and authentication, fields, migrations, queries, transactions, and UPSERT.
Good to know
YDB is a distributed database and does not behave exactly like PostgreSQL or MySQL. A few things to keep in mind:
- It does not enforce foreign keys, uniqueness, or check constraints — enforce these in application code.
- There are no savepoints, so Django's
TestCaseand nestedatomic()rollback do not work — useTransactionTestCasefor database tests. - Primary-key-only and multi-table-inheritance models cannot be inserted — give every model at least one non-primary-key field.
The full list and the supported version matrix are in Compatibility and limitations.
Requirements
Development
This project uses uv for dependency and
environment management (uv also provisions the right Python, so a local
Python install is not required).
git clone https://github.com/ydb-platform/django-ydb-backend.git
cd django-ydb-backend
docker compose up -d --wait # local YDB; requires docker + docker compose
uv sync # installs uv-managed Python + dependencies
uv run python tests/runtests.py
Metadata
Release files for django-ydb-backend 0.0.1b7
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_ydb_backend-0.0.1b7.tar.gz | 54.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_ydb_backend-0.0.1b7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 107.0 kB
Release files / django_ydb_backend-0.0.1b7.tar.gz
| Download URL | django_ydb_backend-0.0.1b7.tar.gz |
|---|---|
| Size | 54.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39eb3b24f6ea6a18d5ec8043e3db820fed2ea911fa8d84704fb19e5190187498
|
|
BLAKE2b-256 checksum How to use checksums |
eb1ae9f37ebd90f39ccaca10eb95cfa054f4a7d9c6d25a75f68a5c46fec519a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jun 25, 2026.
Transparency logRelease files / django_ydb_backend-0.0.1b7-py3-none-any.whl
| Download URL | django_ydb_backend-0.0.1b7-py3-none-any.whl |
|---|---|
| Size | 52.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e42439f271011f7654bcc5d0842c97bd4974a5f54d505bb9b36ef921df2b5c4
|
|
BLAKE2b-256 checksum How to use checksums |
306c56d078f1318bc674b2cf9e415daf60b5f3ef360d6848a4e9ba277e01438d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jun 25, 2026.
Transparency log