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.50 | shaunm | when I pass a Select object in the tuple of the first argument to store.find, the resultant sql is invalid |
16:33.58 | shaunm | is this not the right way to return subselect results? |
16:37.26 | jkakar | shaunm: Nope, it isn't. |
16:37.34 | jkakar | shaunm: What query do you want to execute? |
16:38.03 | jkakar | shaunm: The typical thing is usually to do something like: store.find(MyObject, MyObject.id.is_in(my_subselect)) |
16:38.29 | shaunm | but that's not at all what I want |
16:38.43 | shaunm | I don't want to test against the results of a subselect. I want the result of the subselect |
16:38.52 | shaunm | which is a SELECT COUNT(*) |
16:41.00 | shaunm | select Branch.ident, (select count(*) from Branch as foo where foo.parent_ident = Branch.ident) where ....; |
16:41.50 | jkakar | shaunm: Ah, I see, interesting. |
16:42.18 | jkakar | shaunm: Uhm, have you tried: store.find((Branch.ident, Count(subselect))) |
16:43.00 | jkakar | shaunm: Count is in storm.expr. |
16:43.09 | jkakar | I'm not sure that'll work... |
16:44.38 | shaunm | hmm, I was putting Count in Select. I'll try it that way |
16:47.32 | shaunm | hmm, sql seems valid now, though I'm not getting any results. I might have screwed something else up |
16:56.19 | jkakar | :) |
16:56.53 | jkakar | shaunm: 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.09 | shaunm | jkakar: yeah, I've actually got my own custom tracer in this project |
16:59.23 | shaunm | that's how I'm seeing the sql |
17:00.18 | shaunm | hum, the sql that gets generated for Count(Select(...)) doesn't do the right thing |
17:06.08 | jkakar | shaunm: Yeah, I guess I'm not too surprised. Hmm. |
17:37.10 | shaunm | ah hah, figured it out. had to do it in a fairly different way |
17:37.35 | shaunm | found a similar question answered by jamesh on the list back in march 2009 |
17:40.47 | jkakar | shaunm: Oh cool, what does it look like? |
17:45.58 | shaunm | store.find((cls, Count(tbl.ident)), tbl.parent_ident == cls.ident, ...).group_by(cls.ident) |
17:48.08 | shaunm | though the sql it generates is slower than the other, by about .3s |
17:57.27 | jkakar | shaunm: 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) |