Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wichert/pyramid_sqlalchemy
SQLAlchemy integration for pyramid
https://github.com/wichert/pyramid_sqlalchemy
Last synced: about 2 months ago
JSON representation
SQLAlchemy integration for pyramid
- Host: GitHub
- URL: https://github.com/wichert/pyramid_sqlalchemy
- Owner: wichert
- License: other
- Created: 2014-07-12T18:55:51.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-03-31T12:18:26.000Z (over 4 years ago)
- Last Synced: 2024-10-11T19:16:40.544Z (2 months ago)
- Language: Python
- Homepage: https://pyramid-sqlalchemy.readthedocs.org/
- Size: 76.2 KB
- Stars: 26
- Watchers: 3
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- Changelog: changes.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
.. image:: https://travis-ci.org/wichert/pyramid_sqlalchemy.svg?branch=master
:target: https://travis-ci.org/wichert/pyramid_sqlalchemy`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 BaseObjectclass 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()