Skip to main content
https://travis-ci.org/wichert/pyramid_sqlalchemy.svg?branch=master

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.3 - November 23, 2015

  • Configure a default naming convention, as recommended by alembic). Pull request 3 from Marcin Lulek.

  • Fix a broken import in pyramid_sqlalchemy’s own test when running on Python 3.

  • Allow overriding the database used for testing with the pytest --sql-url option when using the DatabaseTestCase test class. For non-pytest users support the DB_URI environment variable as well.

1.2.2 - September 11, 2014

  • Add dependency on mock for Python <3.3. This fixes import problems who try to import pyramid_sqlalchemy.testing in production code.

1.2.1 - September 1, 2014

  • Move pyramid to a test-only dependency. This makes it simpler to use pyramid_sqlalchemy in non-pyramid contexts.

1.2 - August 30, 2014

  • Use unittest.mock when available. This removes the mock dependency on Python 3.

  • Tests no longer need to mock out pyramid_sqlalchemy.includeme; this is now handled by DatabaseTestCase and the py.test fixtures.

  • Automatically make py.test fixtures available externally. This removes the need to copy & paste them over from the documentation.

  • Fix error on pytest fixture example.

  • Setup Travis to automatically run tests on CPython 2.6, CPython 2.7, CPython 3.3, CPython 3.4 and PyPy.

1.1 - July 14, 2014

  • Add missing schema to the Pyramid-URL in the package description. This broke ReST rendering on the PyPI page.

  • Add a new enable_sql_two_phase_commit() configuration directive to enable two-phase commit.

  • Enable foreign key constraint checking for SQLite in DatabaseTestCase.

  • Use SQLAlchemy events instead of ZopeTransactionExtension to handle integration of zope.sqlalchemy and SQLAlchemy.

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.3.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyramid_sqlalchemy-1.3-py2.py3-none-any.whl (11.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

File hashes

Hashes for pyramid_sqlalchemy-1.3.tar.gz
Algorithm Hash digest
SHA256 f65b2faea24b876c43be27e79f179813ddb38abb7b323a487f934a60cbf1531f
MD5 4dffdb4bb487cfdd2d689a7c055daf10
BLAKE2b-256 5311e81e9f065fe5b3b95413cb71d0fa1ad3120f9766cc7420982ea47122811d

See more details on using hashes here.

File details

Details for the file pyramid_sqlalchemy-1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pyramid_sqlalchemy-1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2b710d2ade12fa17492b11e5a5434d497521384062ccc7cac40404847751cb38
MD5 b2f1d2a7708267e317996b7ab5ab979d
BLAKE2b-256 fdf039b57256e610ac04467499d4eae846329be327bc580d6ca75dac2e824270

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