sprockets.mixins.postgresql
Handler mixins that automatically connect a PostgreSQL client session upon initialization.
Installation
sprockets.mixins.postgresql is available on the Python Package Index and can be installed via pip or easy_install:
pip install sprockets.mixins.postgresql
Documentation
Requirements
Example
The following example demonstrates using the HandlerMixin with a synchronous Tornado RequestHandler <tornado.web.RequestHandler> for a database named postgres:
import os
from sprockets.mixins import postgresql
from tornado import web
os.environ['POSTGRES_HOST'] = 'localhost'
os.environ['POSTGRES_USER'] = 'postgres'
os.environ['POSTGRES_PORT'] = 5432
os.environ['POSTGRES_DBNAME'] = 'postgres'
class PostgresRequestHandler(postgresql.HandlerMixin,
web.RequestHandler):
DBNAME = 'postgres'
def get(self, *args, **kwargs):
result = self.foo_session.query('SELECT * FROM bar')
self.finish({'data': result.items()})
The second example demonstrates using the AsyncHandlerMixin with an asynchronous Tornado RequestHandler for a database named foo:
import os
from sprockets.mixins import postgresql
from tornado import web
os.environ['FOO_HOST'] = 'localhost'
os.environ['FOO_USER'] = 'postgres'
os.environ['FOO_PORT'] = 5432
os.environ['FOO_DBNAME'] = 'foo'
os.environ['FOO_PASSWORD'] = 'bar'
class FooRequestHandler(postgresql.AsyncHandlerMixin,
web.RequestHandler):
DBNAME = 'foo'
@web.asynchronous
def get(self, *args, **kwargs):
result = yield self.foo_session.query('SELECT * FROM baz')
self.finish({'data': result.items()})
result.free()
Version History
Available at https://sprocketsmixinspostgresql.readthedocs.org/en/latest/history.html
Metadata
Release files for sprockets.mixins.postgresql 1.0.1
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 |
|---|---|---|---|---|
| sprockets.mixins.postgresql-1.0.1.tar.gz | 8.6 kB | Without provenance | Details for sprockets.mixins.postgresql-1.0.1.tar.gz |
Release files / sprockets.mixins.postgresql-1.0.1.tar.gz
| Download URL | sprockets.mixins.postgresql-1.0.1.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ab2db8947b2b273a7ada242980f29148fe268553f37d875ceac07f43e291052
|
|
BLAKE2b-256 checksum How to use checksums |
1a6c5fe7d4c9b89cb6b26b0256b6cac360a10365c9129fbc29cf7d249297df6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for sprockets.mixins.postgresql 1.0.1
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.