Skip to main content

pyramid_sqlalchemy provides some basic glue to facilitate using SQLAlchemy with Pyramid.

SQLAlchemy relies on global state for a few things:

  • A MetaData instance which tracks all known SQL tables.

  • A base class for all models using the ORM.

  • A session factory.

Every application using SQLAlchemy must provides its own instance of these. This makes it hard create add-on packages that also use SQLAlchemy, since they either need to have their own SQLAlchemy state, which makes it hard to integrate them into your application, or they need to jump through multiple complex hoops to allow them share state with your application.

pyramid_sqlalchemy helps by providing a canonical location for the global SQLAlchemy state. In addition it provides a convenient way to configure SQLAlchemy in a Pyramid application.

from pyramid.config import Configurator
from pyramid_sqlalchemy import BaseObject

class MyModel(BaseObject):
    __tablename__ = 'my_model'
    ...

def main():
    config = Configurator()
    # Configure SQLAlchemy using settings from the .ini file
    config.include('pyramid_sqlalchemy')
    ...
    return config.make_wsgi_app()

Changelog

1.0 - July 13, 2014

  • First release.

Download files

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

Source Distribution

pyramid_sqlalchemy-1.0.tar.gz (12.5 kB view details)

Uploaded Source

File details

Details for the file pyramid_sqlalchemy-1.0.tar.gz.

File metadata

File hashes

Hashes for pyramid_sqlalchemy-1.0.tar.gz
Algorithm Hash digest
SHA256 5dc7f683db5dffef392f4c91a07a31401260863e0e73c0d438318f9e829e066e
MD5 87277cbf8c157c15298cb44fa91742be
BLAKE2b-256 77a5b93048e6b07c6481934c1b5a5d7be0ee2d16dbf88a435b6622fc0e282bd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page