Skip to content

Commit

Permalink
Merge pull request #5 from thegeorgeous/develop
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
thegeorgeous committed Dec 18, 2015
2 parents fb6fd76 + aeb759f commit 94eff74
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 16 deletions.
19 changes: 19 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
engines:
duplication:
enabled: true
config:
languages:
- python
fixme:
enabled: true
pep8:
enabled: true
radon:
enabled: true
ratings:
paths:
- "**.py"
exclude_paths:
- "docs/*"
- "examples/*"
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python:
env:
- CASSANDRA_DRIVER_VERSION=2.6.0
- CASSANDRA_DRIVER_VERSION=2.7.2

- CASSANDRA_DRIVER_VERSION=3.0.0
install:
- pip install -q cassandra-driver==$CASSANDRA_DRIVER_VERSION
- pip install -q flask
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Flask-CQLAlchemy

[![Latest Version](https://img.shields.io/pypi/v/flask-cqlalchemy.svg)](https://pypi.python.org/pypi/Flask-CQLAlchemy)
[![Build Status](https://travis-ci.org/thegeorgeous/flask-cqlalchemy.svg?branch=master)](https://travis-ci.org/thegeorgeous/flask-cqlalchemy)
[![Code Climate](https://codeclimate.com/github/thegeorgeous/flask-cqlalchemy/badges/gpa.svg)](https://codeclimate.com/github/thegeorgeous/flask-cqlalchemy)
[![Downloads](https://img.shields.io/pypi/dm/flask-cqlalchemy.svg)](https://pypi.python.org/pypi/Flask-CQLAlchemy)



Flask-CQLAlchemy handles connections to Cassandra clusters
and gives a unified easier way to declare models and their
columns
Expand All @@ -14,6 +15,12 @@ columns
pip install flask-cqlalchemy
```

## Dependencies
As such Flask-CQLAlchemy depends only on the cassandra-driver. It is assumed that you already have flask installed.

Flask-CQLAlchemy has been tested with versions 2.6.0, 2.7.2, 3.0.0 of cassandra-driver. It is known to work with all versions >=2.5, but use it at your own risk.
All previous versions of Flask-CQLAlchemy are deprecated.

## Example
```
#example_app.py
Expand All @@ -37,8 +44,7 @@ Start a python shell
```
>>from example_app import db, User
>>db.sync_db()
>>user1 = User(username='John Doe')
>>user1.save()
>>user1 = User.create(username='John Doe')
```
For a complete list of available method refer to the cqlengine [Model documentation](http://datastax.github.io/python-driver/api/cassandra/cqlengine/models.html)

Expand All @@ -54,3 +60,6 @@ CQLAlchemy provides all the option available in the cqlengine connection.setup()

## Tutorial
For a tutorial on how to use Flask-CQLAlchemy check this [post](http://thegeorgeous.com/2015/06/17/creating-a-tumblelog-with-flask-and-flask-cqlalchemy-I.html)

## Contributing
Found a bug? Need a feature? Open it in issues, or even better, open a PR. Please include tests in the PR.
9 changes: 7 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ Installation
$ pip install flask-cqlalchemy
Dependencies
------------
As such Flask-CQLAlchemy depends only on the cassandra-driver. It is assumed that you already have flask installed.

Flask-CQLAlchemy has been tested with versions 2.6.0, 2.7.2, 3.0.0 of cassandra-driver. It is known to work with all versions >=2.5, but use it at your own risk.
All previous versions of Flask-CQLAlchemy are deprecated.

Example
-------
Expand Down Expand Up @@ -49,8 +55,7 @@ Start a python shell
>>from example_app import db, User
>>db.sync_db()
>>user1 = User(username='John Doe')
>>user1.save()
>>user1 = User.create(username='John Doe')
For a complete list of available method refer to the cqlengine `Model documentation <http://datastax.github.io/python-driver/api/cassandra/cqlengine/models.html>`_

Expand Down
15 changes: 7 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
Flask-CQLAlchemy
----------------
Flask-CQLAlchemy handles connections to Cassandra clusters
and gives a unified easier way to declare models and their
columns
Flask-CQLAlchemy handles connections to Cassandra clusters and provides a
Flask-SQLAlchemy like interface to declare models and their columns in a Flask
app
Links
`````
Expand All @@ -18,12 +17,12 @@

setup(
name='Flask-CQLAlchemy',
version='0.2.0',
version='1.0.0',
url='http://thegeorgeous.com/flask-cqlalchemy',
license='BSD',
author='George',
author='George Thomas',
author_email='iamgeorgethomas@gmail.com',
description='Flask-CQLAlchemy handles connections to Cassandra clusters through the cqlengine',
description='Flask-CQLAlchemy handles connections to Cassandra clusters and provides an interface through cqlengine',
long_description=__doc__,
keywords='cassandra cqlengine flask',
packages=['flask_cqlalchemy'],
Expand All @@ -35,7 +34,7 @@
'blist'
],
classifiers=[
'Development Status :: 4 - Beta',
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
Expand Down
6 changes: 4 additions & 2 deletions tests/test_cqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
import uuid
from flask import Flask
from flask.ext.cqlalchemy import CQLAlchemy
from cassandra.cqlengine.management import drop_keyspace, create_keyspace_simple
from cassandra.cqlengine.management import drop_keyspace
from cassandra.cqlengine.management import create_keyspace_simple
from cassandra.cqlengine import models


def make_user_model(db):
class User(db.Model):
uuid = db.columns.UUID(primary_key=True, default=uuid.uuid4)
username = db.columns.Text(index=True, required=False)

return User


class BasicTestCase(unittest.TestCase):

def setUp(self):
Expand All @@ -29,7 +32,6 @@ def setUp(self):
def tearDown(self):
drop_keyspace("cqlengine")


def test_sync_db(self):
self.db.sync_db()
user = self.User.create(username="JohnDoe")
Expand Down

0 comments on commit 94eff74

Please sign in to comment.