Django backend for YugabyteDB
Project description
Prerequisites
GCC
Python 3.8 and above
Psycopg2-binary
Django 3.16 or above
Need for Django Backend for YugabyteDB
YugabyteDB needs a separate backend for Django. This is because of mainly 2 reasons.
Django tries to create Inet data types as primary keys in Django test suites. Since this is not supported, we map Inet types to varchar(15) and varchar(39) in the YB backend.
We also need it to support type change from int to BigInt and numeric(m,n) to double precision. This is required for Django DB migrations. For now, the YB backend ignores these type changes.
Installing in Python Virtual Environment From Source
Install the yb-django package in the python virtual environment. Right now, you have to use the source code:
$ git clone https://github.com/yugabyte/yb-django.git
$ python -m pip install -r <repo_path>/yb-django/requirements.txt
$ python -m pip install -e <repo_path>/yb-django/
Check if it is installed correctly:
$ pip list —local
Use the backend with your Application
Update the DATABASES setting in your Django project’s settings to point to YB server using Django YB backend:
DATABASES = {
'default': {
'ENGINE': 'django_yugabytedb',
'NAME': 'yugabyte',
'HOST': 'localhost',
'PORT': 5433,
'USER': 'yugabyte'
}
}
Known bugs and issues
The creation of indexes in YugabyteDB is a little slow.
Since Inet is mapped to varchar in the backend, comparison between data in the inet column wth Inet type will fail.
For YugabyteDB verions earlier than 2.9, the savepoint feature is not supported.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_yugabytedb-4.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98ba44a53cdb4b8edf87add4cae037dc2826384abe1ca816466534f386f21030 |
|
MD5 | d34bee8d9067de61eb5c1f29e1bd703e |
|
BLAKE2b-256 | b2344bb320f4b9e1800e6de9691baaeaf80ed8281d231b6100d9c13faf847b9b |