code: def trail(self):
          
          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))
docs: Get all visitors by IP and then list the pages they visited in order.