Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

SQLAlchemy helpers for working in Tornado

Project description

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(SessionMixin, RequestHandler):
...     @coroutine
...     def get(self):
...         with self.make_session() as session:
...             count = yield as_future(session.query(UserModel).count)
...
...         # OR count = self.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.

Development

To work on this package, please make sure you have a working Python installation on your system.

  1. Create a virtualenv - python -m venv venv && source venv/bin/activate.
  2. Git clone the repository - git clone https://github.com/siddhantgoel/tornado-sqlalchemy
  3. Install the packages required for development - pip install -r requirements.txt
  4. Install this package - pip install ..
  5. You should now be able to run the test suite - py.test tests/.

Project details


Release history Release notifications

This version
History Node

0.4.1

History Node

0.4.0

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.1

History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
tornado_sqlalchemy-0.4.1-py3-none-any.whl (5.4 kB) Copy SHA256 hash SHA256 Wheel py3 Mar 28, 2018
tornado_sqlalchemy-0.4.1.tar.gz (4.7 kB) Copy SHA256 hash SHA256 Source None Mar 28, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page