[storm] how to know an empty result set

Christopher Armstrong radix at twistedmatrix.com
Sun Jul 29 19:40:50 BST 2007


On 7/29/07, shawn bright <nephish at gmail.com> wrote:
> Hey there all. I had a couple of questions about an empty result set.

These questions were kind of confusing, so I'll try to extract as much
that's useful as I can from them.

> first, what is returned if a result set is empty ? I am assuming a None
> type....

What is returned from what? Do you mean, "if a store.find query would
match no rows, what is returned?"? To which the answer would be: Just
a normal ResultSet which, upon iteration, will yield no results. And
if you called .count() on it, for example, the result would be 0.

> second, is it the same if i use the one() to select just one row.

I don't really know what this means.

> is it the same for a store.find(Person, name == u'joe').one() as it is for
> store.get(Person, 23) ?

And I don't really understand this question either. In either of those
cases, if the query doesn't find any rows, None will be returned.


-- 
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/



More information about the storm mailing list