Michael,

I removed the correlate and it still works. I would have sworn until I
added the correlation I kept getting an error in the subquery.

Thanks again!

On Mar 28, 12:25 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> right so, the correlate() can be against multi_obs directly, not just 
> __table__, and also shouldn't be required at all since auto-correlation is 
> sufficient here.
>
> On Mar 28, 2011, at 12:23 PM, dan wrote:
>
> > Thanks for the feedback. I found an example in google groups that got
> > me on the right track.
>
> > For those interested, my sqlalchemy looks like:
>
> >              multi_obs2 = aliased(multi_obs)
> >              subQ = qaqc.db.session.query(multi_obs2).\
> >                        filter(multi_obs2.m_date >= beginDate).\
> >                        filter(multi_obs2.m_date < endDate).\
> >                        filter(multi_obs2.sensor_id == nnSensorId).\
> >                        filter(multi_obs2.d_top_of_hour == 1).\
> >                        filter(multi_obs2.d_report_hour ==
> > multi_obs.d_report_hour).\
> >                        correlate(multi_obs.__table__).\
> >                        statement
> >              recs = qaqc.db.session.query(multi_obs).\
> >                  filter(multi_obs.m_date >= beginDate).\
> >                  filter(multi_obs.m_date < endDate).\
> >                  filter(multi_obs.sensor_id == sensorId).\
> >                  filter(multi_obs.d_top_of_hour == 1).\
> >                  filter(exists(subQ)).\
> >                  order_by(multi_obs.m_date.asc()).all()
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sqlalchemy" group.
> > To post to this group, send email to sqlalchemy@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > sqlalchemy+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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.

Reply via email to