title: SQLAlchemy Joining with subquery issue
body: <p>I am trying to translate SQL into SQLAlchemy. The SQL version of the query I want is as follows:</p>
  
  <pre><code>SELECT * from calendarEventAttendee
  JOIN calendarEventAttendanceActual ON calendarEventAttendanceActual.id = calendarEventAttendee.attendanceActualId
  LEFT JOIN
     (SELECT bill.id, bill.personId, billToEvent.eventId FROM bill JOIN billToEvent ON bill.id = billToEvent.billId) b 
     ON b.eventId = calendarEventAttendee.eventId AND b.personId = calendarEventAttendee.personId
  WHERE b.id is NULL
  </code></pre>
  
  <p>My SQLAlchemy query is as follows:</p>
  
  <pre><code>query = db.session.query(CalendarEventAttendee).join(CalendarEventAttendanceActual)
  
  sub_query = db.session.query(Bill, BillToEvent).join(BillToEvent, BillToEvent.billId == Bill.id).subquery()
  query = query.outerjoin(sub_query, and_(sub_query.Bill.personId == CalendarEventAttendee.personId, Bill.eventId == CalendarEventAttendee.eventId))
  results = query.all()
  </code></pre>
  
  <p>I am getting an error <code>AttributeError: 'Alias' object has no attribute 'Bill'</code></p>
  
  <p>If I adjust the SQLAlchemy query to the following:</p>
  
  <pre><code>sub_query = db.session.query(Bill, BillToEvent).join(BillToEvent, BillToEvent.billId == Bill.id).subquery()
  query = query.outerjoin(sub_query, and_(sub_query.Bill.personId == CalendarEventAttendee.personId, sub_query.BillToEvent.eventId == CalendarEventAttendee.eventId))
  </code></pre>
  
  <p>results = query.all()</p>
  
  <p>I get an error <code>AttributeError: Bill</code></p>
  
  <p>Any help would be appreciated, thanks!</p>