Skip to main content

Django Cassandra Engine - the Cassandra backend for Django

Project description

Latest Version https://api.travis-ci.org/r4fek/django-cassandra-engine.svg?branch=master Downloads Code Climate

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):

django-cassandra-engine

Installation

Recommended installation:

pip install django-cassandra-engine

Usage

  1. 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.

  1. 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
                }
            }
        }
    }
  2. Define some model:

    #  myapp/models.py
    import uuid
    from cassandra.cqlengine import columns
    from cassandra.cqlengine.models import Model
    
    class ExampleModel(Model):
        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)
  3. Run ./manage.py sync_cassandra

  4. Done!

Documentation

You can find documentation here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-cassandra-engine-0.6.2.tar.gz (11.0 kB view details)

Uploaded Source

File details

Details for the file django-cassandra-engine-0.6.2.tar.gz.

File metadata

File hashes

Hashes for django-cassandra-engine-0.6.2.tar.gz
Algorithm Hash digest
SHA256 9ab22263dbd8562c8725fd408e449e252189233c5ddefd18122a5e7dfd3fcc58
MD5 4798d0238160c51552ed8bad69c09d3a
BLAKE2b-256 83a644795815ca87b51bed6f791cee22e62878a6779a503691468dabe231510e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page