knowledge: migrate sql interface to sqlalchemy

* Replaces run_sql queries with SQLAchemy query.

Signed-off-by: Leonardo Rossi <leonardo.r@cern.ch>
IMHO it's easier to read when you break line after opening parenthesis.
```python
s = db.session.query(KnwKBRVAL).join(KnwKB).filter(
    KnwKBRVAL.m_key.like(keylike),
    KnwKBRVAL.m_value.like(valuelike))
```

Can you use self explanatory names for variables e.g. `s -> subquery/query/...`?