a log.debut(query) would be useful here to see the query which is being executed.