Skip to main content

Storm integration for Flask.

Project description

Test status Documentation status PyPI version status

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

Flask-Storm-0.1.0.tar.gz (906.7 kB view hashes)

Uploaded Source

Built Distribution

Flask_Storm-0.1.0-py2.py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page