Storm integration for Flask.
Project description
Flask-Storm is an extension for Flask that adds support for Canonical’s ORM Storm to your application. Flask-Storm automatically opens and closes database connections on demand when requests need them.
Example
Access to the database is done using the store application context local. Within an application context this variable holds a reference to a Storm Store instance. If no connection is opened it will automatically open one. When the application context is torn down, normally after the request has returned, the store is closed.
from flask_storm import store
from storm.locals import Int, Unicode
class User(object):
__storm_table__ = "users"
id = Int(primary=True)
name = Unicode()
@app.route("/")
def index():
# Get name of user with ID 1
return store.get(User, 1).name
Installation
$ pip install flask_storm
Documentation
Documentation is available on http://flask-storm.readthedocs.io/
Why not Python 3
Sadly Storm is not Python 3 compatible, which is why it doesn’t make sense to make Flask-Storm compatible yet.
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
Built Distribution
File details
Details for the file Flask-Storm-0.1.0.tar.gz
.
File metadata
- Download URL: Flask-Storm-0.1.0.tar.gz
- Upload date:
- Size: 906.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 250a694a2f6838388536f078e312259e6e8aefb89823b28b2ff7976f4c2bbbed |
|
MD5 | 41861aaf1c37a5960b405cf99de346dc |
|
BLAKE2b-256 | f892b1610974cbc699afc94c744259136bfca380d2951956f53698e159728a83 |
File details
Details for the file Flask_Storm-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: Flask_Storm-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89e2bc5f4ad6eaac68d22f027b60f58b399b6601fd8657665ab7560967a4b226 |
|
MD5 | 67c5a3f0a9c4cda6e94d88f998b39d6e |
|
BLAKE2b-256 | 79462ca73d29fc78dd793d5fc3fe375337bb6156e8e7162fd607a2b4633682bb |