connect cassandra to flask
Project description
connect cassandra to flask
Usage
This is an example flask app that reads from a Cassandra cluster:
from flask import Flask from flask_cassandradb import CassandraCluster app = Flask(__name__) cassandra = CassandraCluster() app.config['CASSANDRA_NODES'] = ['cassandra01.flyzen.com'] # can be a string or list of nodes app.config['CASSANDRA_KEYSPACE'] = 'pythonista' # default keyspace @app.route("/cassandra_test") def cassandra_test(): session = cassandra.connect("monty_python") # connect to the monty_python keyspace, it not specified will use the default keyspace. cql = "SELECT * FROM sketches LIMIT 1" r = session.execute(cql) return str(r[0]) if __name__ == '__main__': app.run()
Installation
$ pip install flask-cassandradb
Requirements
Compatibility
Licence
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
File details
Details for the file Flask-CassandraDB-0.0.1.tar.gz
.
File metadata
- Download URL: Flask-CassandraDB-0.0.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 678b9c21a5ff6828d863cd9e51f460b96716f962171967286cebe12cf809fc06 |
|
MD5 | bd855df8d70dfd87dbd864e3fea6b17f |
|
BLAKE2b-256 | bb777c8e7258b6200a6d5b69b9f9179bbf986ed4cc6b182a6c54ae7ad6e6b96c |