Add support for sqlalchemy 0.9

Changes compatible with sqlalchemy 0.6.1+