Storm integration for Flask.
Project description
Flask-Storm
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[fancy]
This installs Flask-Storm with SQL highlighting and reformatting support. If you do not want this drop the fancy.
$ 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.
Changelog
Version are structured like the following: <major>.<minor>.<bugfix>. Unless explicitly stated, changes are made by Andreas Runfalk.
Version 0.1.1
Released on 9th July 2017
Fixed issue with new versions of sqlparse by bumping its version requirement
Version 0.1.0
Released on 19 July 2016
Initial release
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.1.tar.gz
.
File metadata
- Download URL: Flask-Storm-0.1.1.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2692cff7950dabfde7a5065b0704b03f2c8b7b79b37859c350f473ccaffc85ff |
|
MD5 | d3dc14339d5258f6cfe690008a5210d8 |
|
BLAKE2b-256 | b44944902b181a4e474604b481aea058fe86b1e96d4f478804ba5c588f8e6bb5 |
File details
Details for the file Flask_Storm-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: Flask_Storm-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53be6babcd966f47947a13f338a1146f8bbca370134a310b80d4a3d4cf793fe6 |
|
MD5 | a6bfed544bf6bfbe263dbaaa8fac12a0 |
|
BLAKE2b-256 | ebd070eaf2a8f051e489bd6af03f8d853a10b464dedf9da8de0129bffc2e1425 |