Hello all,

I need a little help, guidance to get a Many-to-Many Adjacency
Relationships, a.k.a. a dependency graph working.

Here is the short code:

metadata = MetaData('sqlite:///')

tasks_table = Table('tasks', metadata,
    Column('id', Integer, primary_key = True),
    Column('name', String()),
)

task_depends_on_tasks_table = Table('task_depends_on_tasks', metadata,
    Column('task_id', Integer, ForeignKey('tasks.id')),
    Column('dependent_id', Integer, ForeignKey('tasks.id')),
)

metadata.create_all()

class Task(object):
    def __init__(self, name):
        self.name = name

The problem is off cause the mapping configuration, some blindly
copy'n'pasting ended up in this:

m = mapper(Task, tasks_table,
    properties = {
        'dependsOn' : relation(Task,
            secondary   = task_depends_on_tasks_table,
            remote_side = [tasks_table.c.id],
            primaryjoin =
                tasks_table.c.id == \
                task_depends_on_tasks_table.c.task_id,
            secondaryjoin =
                tasks_table.c.id == \
                task_depends_on_tasks_table.c.dependent_id,
        ),
    }
)
m.compile()

But expectantly this doesn't work. So how would I do this?

Thank you very much.

Regards
Bert Wesarg

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to