Django backend for YugabyteDB
Project description
Prerequisites
GCC
Python 3.8 and above
Psycopg2-binary
Django 3.2 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 from Pypi
Install the django-yugabytedb package with the command:
$ pip install django-yugabytedb
Installing in Python Virtual Environment From Source
The django-yugabytedb package can also be installed from source:
$ 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.
Dropping of Primary keys are not supported
Alter table Add column Unique is not yet supported.
Backfilling of existing rows when new column is added with default value is not yet implemented in yugabytedb.
Type change from int to BigInt and numeric(m,n) to double precision is not yet supported.
ALTER INDEX not supported yet.
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
File details
Details for the file django-yugabytedb-4.0.0.post0.tar.gz
.
File metadata
- Download URL: django-yugabytedb-4.0.0.post0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f326251197f754957a984583a09cd8499dd6b70c9fe85549b14358739404383 |
|
MD5 | 4acd3081567d6bfaf528eb0f3982877e |
|
BLAKE2b-256 | 7494402a0314a71608d7cf6bca74ac9db4748ac2a6a168d01164d252bc7169ea |