Storm integration for Flask.
Project description
Flask-Storm
===========
|test-status| |documentation-status| |pypi-version|
Flask-Storm is an extension for `Flask <https://www.palletsprojects.com/p/flask/>`_ that adds support for Canonical's ORM `Storm <https://storm.canonical.com/>`_ 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 <http://flask.pocoo.org/docs/0.11/appcontext/>`_. 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.
.. code-block:: python
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
------------
.. code-block:: bash
$ pip install flask_storm[fancy]
This installs Flask-Storm with SQL highlighting and reformatting support. If you do not want this drop the ``fancy``.
.. code-block:: bash
$ 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.
.. |test-status| image:: https://travis-ci.org/runfalk/flask-storm.svg
:alt: Test status
:scale: 100%
:target: https://travis-ci.org/runfalk/Flask-Storm
.. |documentation-status| image:: https://readthedocs.org/projects/flask-storm/badge/
:alt: Documentation status
:scale: 100%
:target: http://flask-storm.readthedocs.io/
.. |pypi-version| image:: https://badge.fury.io/py/Flask-Storm.svg
:alt: PyPI version status
:scale: 100%
:target: https://pypi-hypernode.com/pypi/Flask-Storm/
.. Include changelog on PyPI
Changelog
=========
Version are structured like the following: ``<major>.<minor>.<bugfix>``. Unless
explicitly stated, changes are made by
`Andreas Runfalk <https://github.com/runfalk>`_.
Version 0.1.2
-------------
Released on 14th June 2017
- Fixed an issue with query logging in ``flask shell`` and PostgreSQL
Version 0.1.1
-------------
Released on 9th June 2017
- Fixed issue with new versions of sqlparse by bumping its version requirement
Version 0.1.0
-------------
Released on 19 July 2016
- Initial release
===========
|test-status| |documentation-status| |pypi-version|
Flask-Storm is an extension for `Flask <https://www.palletsprojects.com/p/flask/>`_ that adds support for Canonical's ORM `Storm <https://storm.canonical.com/>`_ 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 <http://flask.pocoo.org/docs/0.11/appcontext/>`_. 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.
.. code-block:: python
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
------------
.. code-block:: bash
$ pip install flask_storm[fancy]
This installs Flask-Storm with SQL highlighting and reformatting support. If you do not want this drop the ``fancy``.
.. code-block:: bash
$ 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.
.. |test-status| image:: https://travis-ci.org/runfalk/flask-storm.svg
:alt: Test status
:scale: 100%
:target: https://travis-ci.org/runfalk/Flask-Storm
.. |documentation-status| image:: https://readthedocs.org/projects/flask-storm/badge/
:alt: Documentation status
:scale: 100%
:target: http://flask-storm.readthedocs.io/
.. |pypi-version| image:: https://badge.fury.io/py/Flask-Storm.svg
:alt: PyPI version status
:scale: 100%
:target: https://pypi-hypernode.com/pypi/Flask-Storm/
.. Include changelog on PyPI
Changelog
=========
Version are structured like the following: ``<major>.<minor>.<bugfix>``. Unless
explicitly stated, changes are made by
`Andreas Runfalk <https://github.com/runfalk>`_.
Version 0.1.2
-------------
Released on 14th June 2017
- Fixed an issue with query logging in ``flask shell`` and PostgreSQL
Version 0.1.1
-------------
Released on 9th June 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
Flask-Storm-0.1.2.tar.gz
(23.2 kB
view details)
Built Distribution
File details
Details for the file Flask-Storm-0.1.2.tar.gz
.
File metadata
- Download URL: Flask-Storm-0.1.2.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51195eaf40e4e1e6de3fea7c4f188859ea296c09539cb505845a87f76c037603 |
|
MD5 | 8def2cd389280bab57fd3d13c44ea1be |
|
BLAKE2b-256 | 772fdbc490396f3a9ae1605953c647c8c8e795dce4671bbc2e8e3001ba89418c |
File details
Details for the file Flask_Storm-0.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: Flask_Storm-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5319d93d5ad2616659ac368fda649fee7c7b9d3498ba2002b216f501d89ce69 |
|
MD5 | 9c02ffb77a06135054b2c4a36895b0fa |
|
BLAKE2b-256 | 3da35f84f323fc9a064ce9516a85880365cbf98d12f586f6c7ef8a21e559c767 |