all() returns whatwever is there, 0, 1, n first() returns first if any or None one() asserts there's exactly 1
On Monday 14 January 2008 18:23:28 Adrian wrote: > I am a bit confused by the behavior for the methods all() and one() > if the Query would return an empty result set. In the case of all() > it returns an empty list whereas one() will throw an exception > (sqlalchemy.exceptions.InvalidRequestError). I am sure there was a > reason to implement as it is now but wouldn't it be more convenient > to return simply None (or an empty String) and throw an exception > only if more than one row would be returned? An empty result set as > such is valid and shouldn't be treated as an error. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
