On Feb 23, 2010, at 7:35 PM, David Bolen wrote: > Michael Bayer <[email protected]> writes: > >> if the issue is that you have a query(), and you like to say >> somequery.filter(q == "x"), you'd turn query() into a "subquery" >> (i.e. an alisaed SQLAlchemy expression object) using q.subquery(), >> and then into a "scalar" subquery using as_scalar(), which means the >> select() construct now behaves like a column. as_scalar() is also >> available directly on a select() construct. > > That's it - thanks! I see some attempts in my log to try to use > as_scalar(), but only directly on the query object which doesn't > support that method. I didn't think to put it together with > subquery() first, though in hindsight that makes perfect sense.
funny we don't have as_scalar() on Query() right now, I will investigate. query.statement.as_scalar() works too. > > Thanks again. > > -- David > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
