Just not having a lot of luck here. :) meta.Session.query(Job).order_by(Job.min_level).order_by(Job.descr).filter(Job.tier==1).outerjoin((User_job_progress, and_(User_job_progress.job_id==Job.job_id, User_job_progress.fb_uid==1))).all()
results in: SELECT xxx_jobs.job_id AS xxx_jobs_job_id, xxx_jobs.tier AS xxx_jobs_tier, xxx_jobs.descr AS xxx_jobs_descr, xxx_jobs.blurb AS xxx_jobs_blurb, xxx_jobs.min_level AS xxx_jobs_min_level, xxx_jobs.energy AS xxx_jobs_energy, xxx_jobs.expgain AS xxx_jobs_expgain, xxx_jobs.cashgain AS xxx_jobs_cashgain, xxx_jobs.mastery AS xxx_jobs_mastery FROM xxx_jobs LEFT OUTER JOIN xxx_user_job_progress ON xxx_user_job_progress.job_id = xxx_jobs.job_id AND xxx_user_job_progress.fb_uid = 1 WHERE xxx_jobs.tier = 1 ORDER BY xxx_jobs.min_level, xxx_jobs.descr which gives me what I'm looking for without the joined table. Executes the query properly when the record exists and doesn't exist. However, it is missing the fields from User_jobs_progress. I thought perhaps: meta.Session.query(Job,User_job_progress).order_by(Job.min_level).order_by(Job.descr).filter(Job.tier==1).outerjoin((User_job_progress, and_(User_job_progress.job_id==Job.job_id, User_job_progress.fb_uid==1))).all() which does appear to emit the proper sql, but, that results in: AttributeError: 'NamedTuple' object has no attribute 'descr' 25 % for job in tmpl_context.jobs: 26 ${job} 27 <tr> 28 <td>${job.descr}<br>${job.blurb}</td> iterations of job.descr, job.xxx_jobs_descr, etc all result in the same. It is much closer though. I thought it might be that I only had 1 record, or that the other record was null. Added a second record, added the corresponding left join record. http://www.sqlalchemy.org/docs/reference/orm/query.html?highlight=outerjoin#sqlalchemy.orm.query.Query.outerjoin retunring should be returning -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.