Started work on adding a second table to DVD Pila!, and so far so good. Adding the table to contain information about an episode/disc is easy enough, but I ran into a little confusion once I started modeling the second table in SQLAlchemy.

Defining the table is a snap and setting up the relationship via foriegn key from the dvd_id column in the episodes table to the id column of the dvds table is equally trivial. The small hiccup I first encountered is figuring out where the episodes will be listed in a query object.

I figured things would be more like ActiveRecord and there'd be a episodes attribute on the object which would contain a list of Episode instances. That doesn't seem to be the case with SQLAlchemy. Instead they episodes are listed under a children attribute. Not a big deal, but I think the ActiveRecord way of doing things is a little more intuitive.

I've also come to wish more and more that there was a good way to convert an SQLAlchemy object to JSON. If I was using a server side template the SQLAlchemy object would do just fine I'm sure. Makes me want to look into some other Python ORMs.

We'll see how things go...

Party On!