title: SQLAlchemy query against a view not returning full results
body: <p>I am using Flask-SQLAlchemy (flask_sqlalchemy==2.3.2) for my Flask webapp.
  For normal table queries it has performed flawlessly, but now I am transitioning to  making some of the logic into SQL Views and SQLAlchemy is not capturing the full results.</p>
  
  <p>This is my specific example:</p>
  
  <p>SQL View <code>view_ticket_counts</code>:</p>
  
  <pre><code>CREATE VIEW view_ticket_counts AS
  SELECT event_id, price_id, COUNT(1) AS ticket_count FROM public.tickets
  GROUP BY event_id, price_id
  </code></pre>
  
  <p>When I run this as a normal SQL query with pgAdmin:</p>
  
  <pre><code>SELECT * FROM view_ticket_counts WHERE event_id=1
  </code></pre>
  
  <p>I get the results:</p>
  
  <pre><code>|event_id|price_id|ticket_count|
  |   1    |    1   |     3      |
  |   1    |    2   |     1      |
  </code></pre>
  
  <p>However, if I run a python SQLAlchemy query like so:</p>
  
  <pre><code>ticket_counts = ViewTicketCounts.query.filter_by(event_id=1).all()
  for tc in ticket_counts:
      print(tc.event_id, tc.price_id, tc.ticket_count)
  </code></pre>
  
  <p>It only prints one result: <code>1 1 3</code></p>
  
  <p>So for some reason the SQLAlchemy query or implementation is only fetching the first element, even with <code>.all()</code>.</p>
  
  <p>For completion this is my View Model class:</p>
  
  <pre><code>class ViewTicketCounts(db.Model):
      event_id = db.Column(BigInteger, primary_key=True)
      price_id = db.Column(BigInteger)
      ticket_count = db.Column(BigInteger)
  </code></pre>