Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Pyramid sqlalchemy extension

Project description

A simple pyramid extension which register a sqlalchemy utility. It add a sqla_session property to request object. Session is opened at first access and automatically commited and closed on request’s finished callback.

It tights sqlalchemy session to request lifecycle rather than relying on thread local scoped sessions as recommended in sqlalchemy documentation:

The Session can be established as the request begins, or using a lazy initialization pattern which establishes one as soon as it is needed. The request then proceeds, with some system in place where application logic can access the current Session in a manner associated with how the actual request object is accessed. As the request ends, the Session is torn down as well, usually through the usage of event hooks provided by the web framework.

http://docs.sqlalchemy.org/en/rel_0_8/orm/session.html

Source code and example available on https://github.com/hadrien/pyramid_sqlalchemy_utility

Project details


Download files

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

Files for pyramid_sqlalchemy_utility, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size pyramid_sqlalchemy_utility-0.1.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

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