Hi Seb, thanks for replying. On Apr 3, 12:44 am, Sébastien LELONG <[EMAIL PROTECTED] securities.fr> wrote: > > So, if article 1 is related to article 2.. then there should be two > > rows in the articles_related_articles table like: > > > 1 2 0 > > > 2 1 0 > > Not sure to understand.I can't see where you handle both direction (1=>2, > 2=>1) in your code. As expected, there's only one row in the db. >
I dont have any code for this. Isn't that what a many-many relation is supposed to do? Add two rows both ways on each append?? (I'm new to db stuff, so i might be mistaken though!) My problem is, if only one row is added, like 1=>2... A1.related will have A2 as an object, but A2.related is empty. how do i make it both ways?? > > I am doing this in the shell, but its not working as expected.[...] > > related_id is always getting > > overrideen to NULL, even though I have it specified while creating the > > object. > > About related_id overridden, I think it may be a problem about sessions. Are > you sure session in "session.flush()" is the same as context.current (context > beeing used in assign_mapper) ? Attached is script using assign_mapper only. > related_id is set correctly. > I was using tg-admin shell, from turbogears. you might be right about this thoughk, since your script is working good. > Cheers > > Seb > -- > Sébastien LELONGhttp://www.sirloon.net > sebastien.lelong[at]sirloon.net > > articles.py > 1KDownload --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---