[sqlalchemy] Re: doubly-linked list

2008-01-11 Thread Jonathan LaCour
Jonathan LaCour wrote: I am attempting to model a doubly-linked list, as follows: ... seems to do the trick. I had tried using backref's earlier, but it was failing because I was specifying a remote_side keyword argument to the backref(), which was making it blow up with cycle detection

[sqlalchemy] Re: doubly-linked list

2008-01-11 Thread Denis S. Otkidach
On Jan 11, 2008 7:57 PM, Jonathan LaCour [EMAIL PROTECTED] wrote: Jonathan LaCour wrote: I am attempting to model a doubly-linked list, as follows: ... seems to do the trick. I had tried using backref's earlier, but it was failing because I was specifying a remote_side keyword

[sqlalchemy] Re: doubly-linked list

2008-01-11 Thread Jonathan LaCour
Jonathan LaCour wrote: I am attempting to model a doubly-linked list, as follows: Replying to myself: task_table = Table('task', metadata, Column('id', Integer, primary_key=True), Column('name', Unicode), Column('next_task_id', Integer, ForeignKey('task.id')),

[sqlalchemy] Re: doubly-linked list

2008-01-11 Thread Michael Bayer
All of the crazy mappings today are blowing my mind, so I'll point you to an old unit test with a doubly linked list: http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/test/orm/inheritance/poly_linked_list.py the above uses just a single foreign key (but we can still traverse bi-

[sqlalchemy] Re: doubly-linked list

2008-01-11 Thread Jonathan LaCour
Michael Bayer wrote: All of the crazy mappings today are blowing my mind, so I'll point you to an old unit test with a doubly linked list: Yeah, trust me, it was blowing my mind as well, so I elected not to go this direction anyway. You're also correct that there isn't _really_ a need to