SQLAlchemy helpers for working in Tornado
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tornado_sqlalchemy-0.2.2.tar.gz.
File metadata
- Download URL: tornado_sqlalchemy-0.2.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3371fe1c6d234882f3365c825ad517973d53621f43f499bce0c3e9a165ac7e79
|
|
| MD5 |
fbfb77eddbcba0090a7bf3f269db4e0f
|
|
| BLAKE2b-256 |
94cd9ef0ed6e2e652ecf0b059a9400251b15c04765762245dbfca236fb8fc764
|
File details
Details for the file tornado_sqlalchemy-0.2.2-py3-none-any.whl.
File metadata
- Download URL: tornado_sqlalchemy-0.2.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
037ca6d95932876cd0a35e10de573ce4af2ad58eeb45f39cb49979b4554d0874
|
|
| MD5 |
7989805f53e634678812cbd29fc8221f
|
|
| BLAKE2b-256 |
ccb10a5634b1878c7d31c062904b7e69421dae336d2d8870aac9ae0e97137ff5
|