Coder Social home page Coder Social logo

brunohenriquy / django-cassandra-engine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from squirro/bgds-django-cassandra-engine

0.0 1.0 0.0 1.52 MB

Django Cassandra Engine - the Cassandra backend for Django

License: BSD 2-Clause "Simplified" License

Dockerfile 0.13% Python 99.84% Shell 0.02%

django-cassandra-engine's Introduction

Django Cassandra Engine - the Cassandra backend for Django

All tools you need to start your journey with Apache Cassandra and Django Framework!

Latest version CI Donate

Features

  • integration with latest python-driver and optionally dse-driver from DataStax
  • working flush, migrate, sync_cassandra, inspectdb and dbshell commands
  • support for creating/destroying test database
  • accepts all Cqlengine and cassandra.cluster.Cluster connection options
  • automatic connection/disconnection handling
  • works well along with relational databases (as secondary DB)
  • storing sessions in Cassandra
  • working django forms
  • usable admin panel with Cassandra models

Plans (TODO)

  • User model stored in Cassandra (auth module)

Installation

Recommended installation:

pip install django-cassandra-engine

Basic Usage

  1. Add django_cassandra_engine to INSTALLED_APPS in your settings.py file:

     INSTALLED_APPS = ('django_cassandra_engine',) + INSTALLED_APPS
    
  2. 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 cassandra.cqlengine import columns
     from django_cassandra_engine.models import DjangoCassandraModel
    
     class ExampleModel(DjangoCassandraModel):
         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 sync_cassandra

  5. Done!

Documentation

The documentation can be found online here.

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

Donate

License

Copyright (c) 2014-2018, Rafał Furmański.

All rights reserved. Licensed under BSD 2-Clause License.

django-cassandra-engine's People

Contributors

r4fek avatar slurms avatar bowensong avatar chripede avatar jameyhicks avatar silasbw avatar ameng avatar bezineb5 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.