Yugabyte-db: Django compatibility

Created on 24 Mar 2020  路  3Comments  路  Source: yugabyte/yugabyte-db

Hi!
as I use Django for many projects, I wanted to see if I could use YugabyteDB, so I decided to run the its test suite using YugabyteDB as a regular PostgresDB.

git clone --depth 1 https://github.com/django/django.git -b 3.0.4
cd django
cat << EOF > tests/test_yugabytedb.py
# Inspired by test_sqlite.py
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'postgres',
        'USER': 'postgres',
        'HOST': '127.0.0.1',
        'PORT': '5433',
    },
}
DATABASES['other'] = DATABASES['default']
SECRET_KEY = "django_tests_secret_key"
# Use a fast hasher to speed up tests.
PASSWORD_HASHERS = [
    'django.contrib.auth.hashers.MD5PasswordHasher',
]
EOF
tox -e py3-postgres -- --settings=test_yugabytedb

Here is what I get at the moment:

django.db.utils.NotSupportedError: INDEX on column of type 'INET' not yet supported

Some competitors offer a custom Django backend, but it would be even cooler to be able to use Django together with YugabyteDB without having to rely on external libraries and retaining a strong compatibility with Postgres.

Is this related with #1113?

areysql communitrequest kinnew-feature

Most helpful comment

hi @frafra

Running the test suite there are these issues:

Adding a custom driver seems interesting. It may not support all features but won't be blocking.

All 3 comments

hi @frafra

Running the test suite there are these issues:

Adding a custom driver seems interesting. It may not support all features but won't be blocking.

  • @nchandrappa as well who can help.

I decided to run the its test suite using YugabyteDB as a regular PostgresDB.

Thats an interesting approach! We should definitely shoot for that in the longer run. But more immediately, we may try to unblock the more common usage patterns of Django, for example the one regarding deferred foreign key, which comes up more commonly.

django.db.utils.NotSupportedError: DEFERRABLE constraint not supported yet
LINE 1: ...type_id") REFERENCES "django_content_type" ("id") DEFERRABLE...
                                                             ^
HINT:  See https://github.com/YugaByte/yugabyte-db/issues/1129. Click '+' on the description to raise its priority

Linking the DEFERRABLE constraint error here mentioned in #1129 and #3987 so we can keep all Django related issues in one place.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fabiocmazzo picture fabiocmazzo  路  5Comments

rhzs picture rhzs  路  5Comments

robertpang picture robertpang  路  3Comments

rahuldesirazu picture rahuldesirazu  路  3Comments

rohitjoshi picture rohitjoshi  路  4Comments