IRC log for #storm on 20100916

00:58.12*** join/#storm wallyworld_ (~quassel@27-33-46-253.static.tpgi.com.au)
00:58.42*** join/#storm wallyworld__ (~quassel@27-33-46-253.static.tpgi.com.au)
04:49.13*** join/#storm stub (~stub@canonical/launchpad/stub)
05:24.40*** join/#storm wallyworld_ (~quassel@27-33-46-253.static.tpgi.com.au)
05:26.46*** join/#storm rockstar` (~rockstar@starscream.eventuallyanyway.com)
05:48.03*** join/#storm wallyworld___ (~quassel@27-33-46-253.static.tpgi.com.au)
05:51.59*** join/#storm wallyworld_ (~quassel@27-33-46-253.static.tpgi.com.au)
07:23.11*** join/#storm wallyworld_ (~quassel@27-33-46-253.static.tpgi.com.au)
08:15.31*** join/#storm bigjools (~quassel@82-71-93-254.dsl.in-addr.zen.co.uk)
08:15.31*** join/#storm bigjools (~quassel@canonical/launchpad/bigjools)
08:46.53*** join/#storm keppla (~keppla@i577B0EFA.versanet.de)
10:09.46*** join/#storm infobot (~infobot@rikers.org)
10:09.47*** topic/#storm is The Storm Python ORM - http://storm.canonical.com/ - 0.17 released! || Review branches: https://code.launchpad.net/storm/+activereviews || IRC logs: http://ibot.rikers.org/#storm/ || API documentation: http://people.canonical.com/~jkakar/storm/
12:46.36*** join/#storm fcorrea (~fcorrea@187.3.31.9)
13:16.59*** join/#storm keppla1 (~keppla@i577B219F.versanet.de)
13:20.07*** join/#storm m4v (~znc@unaffiliated/m4v)
15:21.08*** join/#storm webmaven (~webmaven@c-68-35-122-81.hsd1.nm.comcast.net)
16:33.50shaunmwhen I pass a Select object in the tuple of the first argument to store.find, the resultant sql is invalid
16:33.58shaunmis this not the right way to return subselect results?
16:37.26jkakarshaunm: Nope, it isn't.
16:37.34jkakarshaunm: What query do you want to execute?
16:38.03jkakarshaunm: The typical thing is usually to do something like: store.find(MyObject, MyObject.id.is_in(my_subselect))
16:38.29shaunmbut that's not at all what I want
16:38.43shaunmI don't want to test against the results of a subselect. I want the result of the subselect
16:38.52shaunmwhich is a SELECT COUNT(*)
16:41.00shaunmselect Branch.ident, (select count(*) from Branch as foo where foo.parent_ident = Branch.ident) where ....;
16:41.50jkakarshaunm: Ah, I see, interesting.
16:42.18jkakarshaunm: Uhm, have you tried: store.find((Branch.ident, Count(subselect)))
16:43.00jkakarshaunm: Count is in storm.expr.
16:43.09jkakarI'm not sure that'll work...
16:44.38shaunmhmm, I was putting Count in Select. I'll try it that way
16:47.32shaunmhmm, sql seems valid now, though I'm not getting any results. I might have screwed something else up
16:56.19jkakar:)
16:56.53jkakarshaunm: In case you don't know about it, from storm.tracer import debug; debug(True) is very handy for seeing the queries Storm is generating.
16:59.09shaunmjkakar: yeah, I've actually got my own custom tracer in this project
16:59.23shaunmthat's how I'm seeing the sql
17:00.18shaunmhum, the sql that gets generated for Count(Select(...)) doesn't do the right thing
17:06.08jkakarshaunm: Yeah, I guess I'm not too surprised.  Hmm.
17:37.10shaunmah hah, figured it out. had to do it in a fairly different way
17:37.35shaunmfound a similar question answered by jamesh on the list back in march 2009
17:40.47jkakarshaunm: Oh cool, what does it look like?
17:45.58shaunmstore.find((cls, Count(tbl.ident)), tbl.parent_ident == cls.ident, ...).group_by(cls.ident)
17:48.08shaunmthough the sql it generates is slower than the other, by about .3s
17:57.27jkakarshaunm: Hmm, that's annoying.  There must be a way to generate the query you want with Storm.
20:47.57*** part/#storm radix (~r@wordeology.com)
20:54.00*** join/#storm wallyworld_ (~quassel@27-33-46-253.static.tpgi.com.au)
21:59.39*** join/#storm fcorrea (~fcorrea@201-62-110-55-ma.static.vivax.com.br)
22:00.15*** join/#storm fcorrea (~fcorrea@201-62-110-55-ma.static.vivax.com.br)
23:52.42*** join/#storm m4v (~znc@unaffiliated/m4v)

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.