[storm] Mixing explicit and implicit joins
Shaun McCance
shaunm at gnome.org
Thu Mar 12 21:09:32 GMT 2009
I'm trying to figure out how to force a single left join while
still getting implicit joins with other tables. Here's a very
stripped down version of what I've got:
Branch
ident
mod_person_ident (-> Entity)
Entity
ident
SetModule
subj_ident (-> ReleaseSet)
pred_ident (-> Branch)
Here's the wrong version:
store.find((Branch, Entity),
Branch.mod_person_ident == Entity.ident,
Branch.ident == SetModule.pred_ident,
SetModule.subj_ident == "something")
The problem is that with doesn't return any Branch objects
where mod_person_ident==None. This does what I want:
join = (LeftJoin(Branch, Entity,
Branch.mod_person_ident == Entity.ident),
SetModule))
store.using(join).find((Branch, Entity),
Branch.ident == SetModule.pred_ident,
SetModule.subj_ident == "something")
This does what I want. The problem is that this all happens
in a utility function that returns a ResultSet. That utility
function takes *args just like store.find, and it could be
called without a reference to SetModule, or with a reference
to some other table.
So I'd like to get the same implicit list of tables I get
with store.find, but force that single left join. If there
were some function to scan *args and give me a list of the
tables I need, that would do the trick.
Any ideas?
--
Shaun
More information about the storm
mailing list