changed queries to more sqlalcemy style than strings