Hi all,

I'm having trouble setting up a relationship between one table and
itself.

I have some Users, and each user can 'friend' other users. This is in
the Livejournal sense of the word; it's not a mutal relationship so
one user could friend another user, but that second user doesn't have
to friend the first back.

In addition, Users can list their Interests.

I have the following tables defined, plus their equivalent classes.

users_table = Table('users', metadata,
    Column('username', Unicode, primary_key=True),
)

interests_table = Table('interests', metadata,
    Column('interest', Unicode, unique=True, primary_key=True),
)

users_interests = Table('users_interests', metadata,
    Column('user_id', Unicode, ForeignKey('users.username')),
    Column('interest_id', Unicode, ForeignKey('interests.interest')),
)

users_friends = Table('users_friends', metadata,
    Column('from_id', Unicode, ForeignKey('users.username'),
primary_key=True),
    Column('to_id', Unicode, ForeignKey('users.username'),
primary_key=True),
)


I'm completely stuck on the mappers, though. I've got the User <->
Interest one set up okay (I think) but SQLAlchemy refuses to generate
the SQL for User <-> User.

Thanks for any help,

Nick

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

Reply via email to