[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2009-01-17 Thread az
u can look at my posts on the topic and all related too (-:) search for recursive/recursion/graph/sets in short: - storage: - store graph in pure form (nodes/edges only) - easy to maintain/update, very difficult to query - store some preprocessed (cached) denormalized form (all paths

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2009-01-16 Thread rich
Eric, Any additional conclusions to recursively querying your dependency graph? I just found SA, and have been wondering how feasible it would be to manage and query a graph structure somewhat similar to the one you've described. My problem is that I have a number of classes that build

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-26 Thread az
All of that dbcook stuff scares me, though I think I can see why you want it. heh. your model will look this way: --- import dbcook.usage.plainwrap as o2r class Text( o2r.Type): pass class Itemtype( o2r.Base): name = Text() inherits = o2r.Association.Hidden( 'Itemtype',

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
Unfortunately, I posted the wrong version of my Itemtype class above; fortunately it wasn't important for what I was trying to show. Please replace class Itemtype with the following, and note the additional test lines and commentary which I also forgot to include. class Itemtype(object):

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
Well! I guess that's exactly why we post sometimes -- the process of producing the test case bumps the unconscious forward a few steps. I quit and did some pleasure reading for a while then came back. Here's my own answer that does exactly what I needed it to do. Add the following property on

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
Arghh. Accidentally hitting 'Tab' in google groups takes you to the 'Send' button, then your next spacebar press prematurely sends your post. Ok, add the following property on Itemtype: @property def full_heritage(self): result = self.inherits[:] if result: for inherited in

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread az
Eric i'm not sure i follow all your mapping setup as it's too detail. but: i've been battling along similar data/feature inheritance+shading stuff along a branchy, recursive directed graph (not a pure tree as it has alternative short-cut paths in it), all over bitemporal objects and values

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
What I don't like about my own solution, after all (see my 3rd post on this thread, after the accidental 2nd one prematurely submitted), is that it recursively traverses the Itemtype graph to make a list of itemtypes to constrain the scope of a request for the list of features upon which a given

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
Svil, Thanks for your reply. I have been following your posts with interest over the past half year (or I thought even longer). At first I thought you were crazy. But now I've found myself creating a model of similar complexity, as necessary to express the domain I'm working on. The purpose

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread az
Thanks for your reply. I have been following your posts with interest over the past half year (or I thought even longer). At first I thought you were crazy. But now I've found myself creating a model of similar complexity, as necessary to express the domain I'm working on. i think you're

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Ongerth
Yes, I am very glad to be free of multiversion and bitemporal concerns, although I will eventually be setting this up for partial multimaster asynchronous replication (but with a lot of intentional compromises in order to avoid the major, currently unsolved, problems with that entire field). As

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Lemoine
Eric, a friendly comment: you do sound as crazy as Svil :-) Eric 2008/11/25, Eric Ongerth [EMAIL PROTECTED]: Yes, I am very glad to be free of multiversion and bitemporal concerns, although I will eventually be setting this up for partial multimaster asynchronous replication (but with a lot