fix sqlalchemy statement

sqlalchemy use immutable objects, so we must do q=q.where..

Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>