Replace getAllWhere with SA query
implement retrieve with SA queries
Use a thread local session

By using scoped_session, it will maintain a registry, so the same
session will be returned by subsequent calls to Session()
whitespace cleanup
Use sqlalchemy instead of SQL UPDATE