pyramid_formalchemy provides a CRUD interface for Pyramid based on FormAlchemy. Which is to say it looks at your SQLAlchemy models and automagically generates an HTML interface to create, read, update and delete instances of those models from the database, very much like Django’s admin interface. That sounds pretty cool, doesn’t it? In this post I will demonstrate how to get it up and running and then start customizing the forms.
Cornice provides helpers to build and document REST-ish Web Services with Pyramid; and SQLAlchemy is the best Python ORM. I wanted to use Cornice and SQLAlchemy to make a simple RESTful webapp and couldn’t find any info on how to put them together.
Here’s how (full source in this github repo):
I was, I wanted to know:
- What is the DBSession anyway?
- How does that work in my unit tests?
- If I want to use my webapp code outside of the webapp (in a background process) how do I do that?
Let’s see if we can answer those questions.