> Well, I don't really see the connection between .scalar() and .list(), > other than they are kind of antonyms, but FWIW I always thought that .list() > was an odd duck anyway, seeing as how the arguably more Pythonic list(query) > works fine.
(expanding on this a bit) More generally, it's the iterative nature of a query object that makes a lot of the .first() and so on more semantic sugar than anything else anyway. I'll routinely write things like: for row in query: process(row) or results = [process(r) for r in query] instead of: results = query.list() for row in results: process(row) I would even be OK with losing all the .select() and .first() and etc. completely and deal with queries using a library of function STL-like first-order functions like first(query) one(query) etc. so color me radical, I guess. Rick On 6/4/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > > > > > > On Jun 4, 2007, at 9:56 AM, Rick Morrison wrote: > > > > > The use of scalar() here seems out of place with both the common CS > > > usage of the word (e.g. scalar == single-valued), and the use of > > > scalar() in the SQL layer. Single row results in the ORM are rows, > > > not a single datatype. It's another potential point of confusion, > > > like the ORM .select() is/was. > > > > > > I would say drop scalar() in the ORM namespace, and for single-row > > > results, use > > > > > > .first() -- returns first row > > > .one() -- returns first row, raise exception if more than one result > > > > > > > > > > then we sort of have to rename list() to be all(). > > > > its all fine with me if everyone out there doesnt mind changing their > > code by the time 0.5 comes out.... > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---