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.2.2.tar.gz (3.0 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.2.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for tornado_sqlalchemy-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3371fe1c6d234882f3365c825ad517973d53621f43f499bce0c3e9a165ac7e79
MD5 fbfb77eddbcba0090a7bf3f269db4e0f
BLAKE2b-256 94cd9ef0ed6e2e652ecf0b059a9400251b15c04765762245dbfca236fb8fc764

See more details on using hashes here.

File details

Details for the file tornado_sqlalchemy-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for tornado_sqlalchemy-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 037ca6d95932876cd0a35e10de573ce4af2ad58eeb45f39cb49979b4554d0874
MD5 7989805f53e634678812cbd29fc8221f
BLAKE2b-256 ccb10a5634b1878c7d31c062904b7e69421dae336d2d8870aac9ae0e97137ff5

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