Move check_sql into QueryRevision model

Change-Id: I906f7be476ab6ec8d3815f2ab8e8736c2f61ad68
Show only latest run of query in queries list

- Add latest_run to QueryRevision model
- Rename latest_rev to latest_rev_id on Query for consistency
  and for SQLAlchemy relationship to work properly
- Start using session directly in app.py, to give us better
  control for add / commit cycles. The 'repository' classes
  will go away soon

Change-Id: Ic8f3a3dc7e9b4da53e8e6e1e4176f8a5ce7f8b26