Skip to main content

Django Cassandra Engine - the Cassandra backend for Django

Project description

https://travis-ci.org/r4fek/django-cassandra-engine.svg?branch=master

django-cassandra-engine is a database wrapper for Django Framework. It uses latest Cqlengine which is currently the best Cassandra CQL 3 Object Mapper for Python.

License:

2-clause BSD

Keywords:

django, cassandra, orm, nosql, database, python

URL (pypi):

django-cassandra-engine

Requirements

  • cassandra

  • cqlengine

  • django-nonrel

  • djangotoolbox

Features

  • complete django integration

  • working syncdb and flush commands

  • support for creating/destroying test database

  • accept all Cqlengine connection options

  • automatic connection/disconnection handling

  • support for multiple databases (also relational)

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',)
  2. 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
                }
            }
        }
    }
  3. Define some model:

    #  myapp/models.py
    import uuid
    from cqlengine import columns
    from 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)
  4. Run ./manage.py syncdb

  5. Done!

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.0.5.tar.gz (6.4 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for django-cassandra-engine-0.0.5.tar.gz
Algorithm Hash digest
SHA256 034e4d9d5e8b828b938e226305b078f59339e4e2c32703973bf028580ffb0914
MD5 caa170ffb25d6093a58611f2db1bd496
BLAKE2b-256 c46eaa2f7c472417c4e9d19110652b5c97abb134aa8fcbaf395a02e7ff83eab7

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