title: Need help building an SQLAlchemy query + subquery
body: <p>This is the SQL I need SQLAlchemy to generate via its ORM.</p>
  
  <pre><code>SELECT
      *
  FROM
      notes
  WHERE
      notes.student_id == {student_id} 
    OR
      notes.student_id IN (
          SELECT
              *
          FROM
              peers
          WHERE
              peers.student_id == {student_id}
            AND
              peers.date_peer_saved &gt;= notes.date_note_saved
      )
  </code></pre>
  
  <p>The SQL is untested. I just wrote it to demo what I need SQLAlchemy to do.</p>
  
  <p>Basically, the logged in student should see a list of saved <code>notes</code>. The only <code>notes</code> the student should see, however, are those posted by themself or those posted by one of their peers - But only those peers they 'friended' after the note had been saved.</p>
  
  <p>This way, a student won't see notes posted by another student before they became peers.</p>
  
  <p>I'm having trouble getting this to run in SQLAlchemy's ORM, however. Any help?</p>