Skip to content

About

Adds support for Canonical's Storm ORM to Flask. Only use this if you are already deeply invested in Storm, otherwise use Flask-SQLAlchemy.

Resources

Stars

1 star

Watchers

3 watching

Forks

Latest commit

 

History

40 Commits

Folders and files

Repository files navigation

Flask-Storm

Test 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

Flask-Storm is tested Python 3.11 or newer.

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 https://runfalk.github.io/flask-storm

Development

Install uv first.

# Setup environment
uv sync --extra fancy

# Run test suite
uv run --extra fancy pytest

# Build documentation
uv run sphinx-build doc/ doc-build/

# Run auto formatter
uv run ruff format flask_storm/ tests/

# Run linter
uv run ruff check flask_storm/ tests/

# Build source and wheel distributions
uv build

See the changelog for release history.

About

Adds support for Canonical's Storm ORM to Flask. Only use this if you are already deeply invested in Storm, otherwise use Flask-SQLAlchemy.

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages