Fix query statement (template slient, but Python not)