knowledge: API migration to SQLAlchemy

* Replaces run_sql queries with SQLAchemy query.

* Refactors module in order to move logic from api to model.

Signed-off-by: Leonardo Rossi <leonardo.r@cern.ch>
I would try to find the object by `old_key` and update `key` and `value`.

### Proposal

Something like this `models. KnwKBRVAL.query.filter_by(m_key=old_key).update(dict(m_key=key, m_value=value))` if I understand the function correctly.