Support SQLAlchemy>=0.6.0

Also did a pep8 cleanup and reorganized imports.