Bottle plugin for Cassandra/Pycassa
Project description
bottle-pycassa
==============
Plugin for bottle to allow for cassandra connection pools
Usage example:
```
import bottle
from bottle import run, get
from bottle import HTTPError
from bottle.ext import pycassa
from pycassa.pool import ConnectionPool
from pycassa.columnfamily import ColumnFamily
from pycassa import NotFoundException
pool = ConnectionPool("my_keyspace",
['127.0.0.1'],
pool_timeout = 5, pool_size=24)
app = bottle.Bottle()
plugin = pycassa.Plugin(pool, keyword="cass")
app.install(plugin)
@app.get('/:query')
def show(query, cass):
my_column_family = ColumnFamily(cass, 'my_column_family')
try:
result = my_column_family.get(1167864277)
return result
except NotFoundException, nfe:
return HTTPError(404, 'Entity not found.')
run(app=app, host='localhost', port=80, reloader=True)
==============
Plugin for bottle to allow for cassandra connection pools
Usage example:
```
import bottle
from bottle import run, get
from bottle import HTTPError
from bottle.ext import pycassa
from pycassa.pool import ConnectionPool
from pycassa.columnfamily import ColumnFamily
from pycassa import NotFoundException
pool = ConnectionPool("my_keyspace",
['127.0.0.1'],
pool_timeout = 5, pool_size=24)
app = bottle.Bottle()
plugin = pycassa.Plugin(pool, keyword="cass")
app.install(plugin)
@app.get('/:query')
def show(query, cass):
my_column_family = ColumnFamily(cass, 'my_column_family')
try:
result = my_column_family.get(1167864277)
return result
except NotFoundException, nfe:
return HTTPError(404, 'Entity not found.')
run(app=app, host='localhost', port=80, reloader=True)
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
bottle-pycassa-0.1.tar.gz
(2.8 kB
view details)
File details
Details for the file bottle-pycassa-0.1.tar.gz
.
File metadata
- Download URL: bottle-pycassa-0.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3bc4e4a0b9688367834c90467ea68dfba97810935a62761cb81f59d015190ae |
|
MD5 | e8d7030329f17b6a56a73e595384b8f3 |
|
BLAKE2b-256 | 48a18e3ea01133dd8e5c7d49140c51af6c961024be3bd34638c3386373bd279d |