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?
hi @frafra
Running the test suite there are these issues:
deferred foreign key since that's what Django Uses: https://github.com/yugabyte/yugabyte-db/issues/1709Adding a custom driver seems interesting. It may not support all features but won't be blocking.
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.
Most helpful comment
hi @frafra
Running the test suite there are these issues:
deferred foreign keysince that's what Django Uses: https://github.com/yugabyte/yugabyte-db/issues/1709LINE 1: ...al NOT NULL PRIMARY KEY, "char_field" varchar(10) COLLATE "s... https://github.com/YugaByte/yugabyte-db/issues/1127
Adding a custom driver seems interesting. It may not support all features but won't be blocking.