SQLAlchemy integration

Okay, here's an updated version: https://gist.github.com/tsukanov/56018dca27c7f980c2ea.

Thanks for your tips, @mineo. Looks like it's actually smart. :)