skip to navigation
skip to content

tornado-sqlalchemy 0.3.3

SQLAlchemy helpers for working in Tornado

Python helpers for using SQLAlchemy with Tornado.

Installation

$ pip install tornado-sqlalchemy

Usage

>>> from tornado.gen import coroutine
>>> from tornado.web import Application, RequestHandler
>>> from tornado_sqlalchemy import as_future, make_session_factory, SessionMixin
>>>
>>> factory = make_session_factory('postgres://user:password@host/database')
>>>
>>> class MyRequestHandler(RequestHandler, SessionMixin):
...     @coroutine
...     def get(self):
...         with self.make_session() as session:
...             count = yield as_future(session.query(UserModel).count)
...
...         self.write('{} users so far!'.format(count)
...
>>> app = Application(((r'/', MyRequestHandler),), session_factory=factory)

Documentation

Documentation is available at Read The Docs.

 
File Type Py Version Uploaded on Size
tornado_sqlalchemy-0.3.3-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2017-09-14 4KB
tornado_sqlalchemy-0.3.3.tar.gz (md5) Source 2017-09-14 4KB