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 'n'
1: D200 One-line docstring should not occupy 3 lines
26: D400 First line should end with '.', not ')'
26: D200 One-line docstring should not occupy 3 lines