add query to tornado