Updated SQL Alchemy Hook

The updated version follows the documentation for scoped sessions
in context of web applications. The old approach fails, if engine
connections are invalidated (e.g. MySql Server Timeout or Restart).
There might be some open, uncommitted sessions, that prevent the
engine from refreshing the connection pool. Using the scoped_session
as in this update and recommended in the latest docs fixes the
problem.