redirector: migrate sql interface to sqlalchemy

* Replace run_sql queries with SQLAchemy query.

Signed-off-by: Leonardo Rossi <leonardo.r@cern.ch>
1: D400 First line should end with '.', not 's'
1: D200 One-line docstring should not occupy 3 lines
34: D101 Docstring missing
70:37: F841 local variable 'err' is assigned to but never used