Django Cassandra Engine - the Cassandra backend for Django
Project description
django-cassandra-engine is a database wrapper for Django Framework. It uses the latest cassandra-driver while primarily utilizing Cqlengine which is currently the best Cassandra CQL 3 Object Mapper for Python and was integrated into cassandra-driver.
- License:
2-clause BSD
- Keywords:
django, cassandra, orm, nosql, database, python
- URL (pypi):
Installation
Recommended installation:
pip install django-cassandra-engine
Usage
Add django-cassandra-engine to INSTALLED_APPS in your settings.py file:
INSTALLED_APPS = ('django_cassandra_engine',) + INSTALLED_APPS
IMPORTANT: This app should be the first app on INSTALLED_APPS list.
Also change DATABASES setting:
DATABASES = { 'default': { 'ENGINE': 'django_cassandra_engine', 'NAME': 'db', 'TEST_NAME': 'test_db', 'HOST': 'db1.example.com,db2.example.com', 'OPTIONS': { 'replication': { 'strategy_class': 'SimpleStrategy', 'replication_factor': 1 } } } }
Define some model:
# myapp/models.py import uuid from cassandra.cqlengine import columns from cassandra.cqlengine.models import Model class ExampleModel(Model): read_repair_chance = 0.05 # optional - defaults to 0.1 example_id = columns.UUID(primary_key=True, default=uuid.uuid4) example_type = columns.Integer(index=True) created_at = columns.DateTime() description = columns.Text(required=False)
Run ./manage.py sync_cassandra
Done!
Documentation
You can find documentation here.
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-cassandra-engine-0.5.2.tar.gz
.
File metadata
- Download URL: django-cassandra-engine-0.5.2.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4196c75a0596c1b2a619b45a7e73f942948c864e6f9e92c19e3e7b324a3a939 |
|
MD5 | 85ddca93f3d7d5a75449c476e6569111 |
|
BLAKE2b-256 | 45e6db0a666f12dabd18040565386f6a501fb3848541eef0317cbfaaac6a5cf5 |