All,
I am attempting to model a doubly-linked list, as follows:
--------------------------------------------------------------------
task_table = Table('task', metadata,
Column('id', Integer, primary_key=True),
Column('name', Unicode),
Column('next_task_id', Integer, ForeignKey('task.id')),
Column('previous_task_id', Integer, ForeignKey('task.id'))
)
class Task(object): pass
mapper(Task, task_table, properties={
'next_task' : relation(
Task,
primaryjoin=task_table.c.next_task_id==task_table.c.id,
uselist=False
),
'previous_task' : relation(
Task,
primaryjoin=task_table.c.previous_task_id==task_table.c.id,
uselist=False
)
})
--------------------------------------------------------------------
Now, this works, but only in one direction. If I create a list
structure with a bunch of instances using `next_task`, then that
direction of the relation works fine, but the reverse side doesn't
seem to get managed automatically. Same in the other direction. Is
there a way to get SQLAlchemy to understand that these relations are
the inverse of one another, and manage both sides for me?
--
Jonathan LaCour
http://cleverdevil.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---