Skip to main content

SQLAlchemy helpers for working in Tornado

Project description

https://badge.fury.io/py/tornado-sqlalchemy.svg https://travis-ci.org/siddhantgoel/tornado-sqlalchemy.svg?branch=master https://readthedocs.org/projects/tornado-sqlalchemy/badge/?version=latest

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.

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

tornado_sqlalchemy-0.3.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tornado_sqlalchemy-0.3.2-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file tornado_sqlalchemy-0.3.2.tar.gz.

File metadata

File hashes

Hashes for tornado_sqlalchemy-0.3.2.tar.gz
Algorithm Hash digest
SHA256 fd823d0113cef20d6b31f271f2387b7eba08bf9c8923474d23b942565609ca2e
MD5 59f2724974bbb49a95733f0dabf4c1bc
BLAKE2b-256 13ae8b51a2e04524e09fe15c58dc315b8fc4770421e70fb4f2e84b105d1412d8

See more details on using hashes here.

File details

Details for the file tornado_sqlalchemy-0.3.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for tornado_sqlalchemy-0.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 87a1d304f07c9855995407f88a974298dc2263fdf349b899fa0eab86bff78b87
MD5 cc5d43d8bcc72386f496b9bd307931e1
BLAKE2b-256 34a9b547cb864b0d1d9237c41eb1d0f7009c2c31155d1162efeb1e344b98508a

See more details on using hashes here.

Supported by

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