Django¶
The CrateDB team develops and supports a custom-built driver, cratedb-django
Getting started¶
Installing the library:
pip install cratedb-django
Once the library is installed, set the appropriate settings.py
DATABASES = {
"default": {
"ENGINE": "cratedb_django",
"SERVERS": ["localhost:4200"],
}
}
DEFAULT_AUTO_FIELD = "cratedb_django.fields.AutoUUIDField"
For a model to be compatible with CrateDB, import and use CrateDBModel:
from cratedb_django.models import fields
from cratedb_django.models import CrateDBModel
class Metrics(CrateDBModel):
value = fields.IntegerField()
Django migrations can be run in CrateDB, all migrations for the default applications (contrib, auth, admin…) are tested and work. In spite of that, it’s recommended that you run anything transactional in a transactional database, like Postgres and use CrateDB as your analytical database.
CrateDB has certain constraints that make migration management different.
What’s supported?¶
Django ORM has many features, see feature-list for a comprehensive list of supported features. Feel free to open a new issue if you need a new feature.