Adding some SQLAlchemy magic

Hi Marten,

I can do a Pull Request on your Pull Request (have you seen the movie inception? ). Anyways, I'm currently implementing some of the SQLAlchemy Magic. So there's a few more commits coming from me, but I wanted to try out this PR on PR feature first.