You are a life-saver; thank you! On Aug 27, 4:16 pm, "Diez B. Roggisch" <[email protected]> wrote: > On Aug 27, 2010, at 8:54 PM, uramagget wrote: > > > > > > > Hello Elixir, > > > Fairly new to this Elixir + SA abstraction, and the ease of > > establishing relationships between entities sold me. I've attempted > > giving this a shot by trying to implement it on a forum system I've > > been working on, with the following code: > > >http://paste.pocoo.org/show/x0kg5V5686py3oYjUadw/ > > > The Topic entity initializes fine without the `lastpost` relationship, > > although when attempting to initialize it with the relation specified, > > an exception is raised. Is there something that I am doing wrong that > > I need to rectify? I'm not exactly sure what specifying an `inverse` > > argument would do, as I believe I tried passing inverse='Topic' for > > the `lastpost` relation. > > > Exception: Several relations match as inverse of the 'topic' relation > > in entity 'Post'. You should specify inverse relations manually by > > using the inverse key > > You define the relation wrong - you want a > > lastpost_id > > column on Topic, which means that you need to declare it as > > lastpost = ManyToOne("Post") > > on Topic. Remember, from the view of Post, one post *could* be set on a great > many Topics as lastpost - that's not your intended semantic, but it's > perfectly possible from a DB-point of view. > > And if Elixir still complains, you need to define inverse="<name of the > relation>", *NOT* with the name "Topic" or "Post" - these are the classes, > not the relations!!! > > Diez
-- You received this message because you are subscribed to the Google Groups "SQLElixir" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlelixir?hl=en.
