Get all visitors by IP and then list the pages they visited in order.

def trail(self):
        """
        Get all visitors by IP and then list the pages they visited in order.
        """
        inner = (self.get_query()
                 .select(PageView.ip, PageView.url)
                 .order_by(PageView.timestamp))
        return (PageView
                .select(
                    PageView.ip,
                    fn.array_agg(PageView.url).alias('urls'))
                .from_(inner.alias('t1'))
                .group_by(PageView.ip))