Project description

Good frameworks, like [Pyramid][] and [Angular][], help developers writetestable code. [SQLAlchemy][] is a great framework. However, the sheerconvenience of having model instances returned from a database queryencourages developers to write large ORM classes which can be hard to test.

One way to avoid this is to keep model classes [thin][] and write separate codeto instantiate and manipulate them. The downside of this approach is the loss inconvenience: the separated, easily testable code isn't provided by default asan attribute of the model instances returned from a database query.

[pyramid_alchemy][] provides an `add_model_method` Pyramid[configuration directive]() that extends [SQLAlchemy ORM][] classes in the sameway that `add_request_method` [extends the Pyramid Request][]. Using thisdirective allows developers to write easily testable code that is convenientlyavailable as a model instance attribute. For example, if you [include][] thisin your Pyramid application:

Just as you can hang a Pyramid view off any context object implementing aspecific interface, you can extend any model instance implementing an interface.For example, if your model looked something like this: