code: def get_collection(self, qs, view_kwargs):
          
          self.before_get_collection(qs, view_kwargs)
  
          query = self.query(view_kwargs)
  
          if qs.filters:
              query = self.filter_query(query, qs.filters, self.model)
  
          if qs.sorting:
              query = self.sort_query(query, qs.sorting)
  
          object_count = query.count()
  
          if getattr(self, 'eagerload_includes', True):
              query = self.eagerload_includes(query, qs)
  
          query = self.paginate_query(query, qs.pagination)
  
          collection = query.all()
  
          collection = self.after_get_collection(collection, qs, view_kwargs)
  
          return object_count, collection
docs: Retrieve a collection of objects through sqlalchemy
  
          :param QueryStringManager qs: a querystring manager to retrieve information from url
          :param dict view_kwargs: kwargs from the resource view
          :return tuple: the number of object and the list of objects