tornado-models
sqlalchemy and redis for tornado
Installation
pip install tornado-models
Usage
sqlalchemy
from tornado.web import Application
from tornado_models.sqlalchemy import SQLAlchemy
from my_app.handlers import IndexHandler
app = Application(
((r'/', IndexHandler),),
db=SQLAlchemy(database_url)
)
##################################
from tornado_models.sqlalchemy import SQLAlchemy
db = SQLAlchemy(url=database_url)
class User(db.Model):
id = Column(BigInteger, primary_key=True)
username = Column(String(255), unique=True)
##################################
from tornado_models.sqlalchemy import SessionMixin
from tornado_models import as_future
class NativeCoroutineRequestHandler(SessionMixin, RequestHandler):
async def get(self):
with self.db_session() as session:
count = await as_future(session.query(User).count())
self.write('{} users so far!'.format(count))
redis
from tornado.web import Application
from tornado_models.redis import Redis
from my_app.handlers import IndexHandler
app = Application(
((r'/', IndexHandler),),
redis=Redis(pool_options(dict(host='localhost', port=6379, db=0)))
)
##################################
from tornado_models.redis import RedisMixin
from tornado_models import as_future
class NativeCoroutineRequestHandler(RedisMixin, RequestHandler):
async def get(self):
with self.redis_session() as session:
value = await as_future(session.get('key'))
self.write('redis value is {}!'.format(value))
Metadata
Release files for tornado-models 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tornado_models-0.1.7.tar.gz | 9.9 kB | Without provenance | Details for tornado_models-0.1.7.tar.gz |
Release files / tornado_models-0.1.7.tar.gz
| Download URL | tornado_models-0.1.7.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0bcdf3fe9952ebc61f115b8c02ff44be12ec23c943c328785ead4cbca426c66b
|
|
BLAKE2b-256 checksum How to use checksums |
17ed5a8d2ee08825498d6acc853679ba8e1c5f1a1809c6145153704c51e4aa73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
|
Security for tornado-models 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.