Django backend for CockroachDB
Project description
CockroachDB backend for Django
Install and usage
Use the version of django-cockroachdb that corresponds to your version of Django. For example, to get the latest compatible release for Django 2.2.x:
pip install django-cockroachdb==2.2.*
The minor release number of Django doesn't correspond to the minor release number of django-cockroachdb. Use the latest minor release of each.
Configure the Django DATABASES setting similar to this:
DATABASES = {
'default': {
'ENGINE': 'django_cockroachdb',
'NAME': 'django',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '26257',
}
}
Notes on Django fields
-
CharField'smax_lengthis ignored. It uses the same storage asTextFieldsoCharFieldis introspected byinspectdbasTextField. -
IntegerFielduses the same storage asBigIntegerFieldsoIntegerFieldis introspected byinspectdbasBigIntegerField. -
AutoFieldandBigAutoFieldare both stored as integer (64-bit) withDEFAULT unique_rowid().
Known issues and limitations (as of cockroachdb 19.2.1)
-
CockroachDB doesn't support savepoints. This means a few things:
- Django's transaction.atomic() can't be nested.
- Django's
TestCaseworks likeTransactionTestCase. That is, transactions aren't used to speed up the former.
-
CockroachDB can't disable constraint checking, which means certain things in Django like forward references in fixtures aren't supported.
-
Migrations have some limitations. CockroachDB doesn't support:
- changing column type
- dropping or changing a table's primary key
-
Incorrect queries:
- The extract() function doesn't respect the time zone.
- Interval math across daylight saving time is incorrect.
date_trunc('week', <value>)truncates to midnight Sunday rather than Monday- date_trunc() results are incorrectly localized.
- cast() timestamptz to time doesn't respect the time zone.
- Interval math may be incorrect on date columns.
-
Unsupported queries:
- Mixed type addition in SELECT:
unsupported binary operator: <int> + <float> - UPDATE float column with integer column:
value type int doesn't match type FLOAT8 of column <name> - Division that yields a different type:
unsupported binary operator: <int> / <int> (desired <int>) - The power() database function doesn't accept negative exponents:
power(): integer out of range - The
StdDevandVarianceaggregates aren't supported. - extract() doesn't support interval columns (DurationField):
unknown signature: extract(string, interval) - The log() function doesn't support custom bases:
unknown signature: extract(string, interval) - sum() doesn't support arguments of different types:
sum(): unsupported binary operator: <float> + <int> - greatest() doesn't support arguments of different types:
greatest(): expected <arg> to be of type <type>, found type <other type> - Common aggregation queries fail:
column must appear in the GROUP BY clause or be used in an aggregate function - The isoyear lookup isn't supported:
extract(): unsupported timespan: isoyear - Using the avg() database function on an interval column (DurationField) isn't supported:
unknown signature: avg(interval) - timezone() doesn't support UTC offsets:
timezone(): unknown time zone UTC...
- Mixed type addition in SELECT:
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-cockroachdb-2.2a1.tar.gz.
File metadata
- Download URL: django-cockroachdb-2.2a1.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92d4642eb3e3caba512d6771612ad9c8821a508d7f1d4fc8ea08991c4e4228cc
|
|
| MD5 |
d19ba2c46d639fcbd7711090968b78fa
|
|
| BLAKE2b-256 |
f937acf73ff338169ba5c6a03fe87e34e2e1234c9af1946be525ad40ded186af
|
File details
Details for the file django_cockroachdb-2.2a1-py3-none-any.whl.
File metadata
- Download URL: django_cockroachdb-2.2a1-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bec7ee3a74e228e89b3e41b6af3810a412a6e670cc39e6a309fd272c03ec1738
|
|
| MD5 |
93062a02d220148a8c5c433f94e2cf7a
|
|
| BLAKE2b-256 |
236774a9446c560a860d167142862f4ac1a48ec42564a78b593067503df00b4e
|