im pretty sure we've had this pattern before (didnt check tho). you should be able to do a mostly-normal mapping setup, but you will need to explicitly specify the primaryjoin and secondaryjoin conditions.On Aug 17, 2006, at 7:17 AM, Michael Carter wrote: Hello, I was having some trouble with mapping the following two tables:
users = Table('users', meta, Column('id', Integer, primary_key = True), Column('user_name', String(16) )) friendship = Table('friendship', meta, Column('user_id', Integer, ForeignKey('users.id'), primary_key=True), Column('friend_id', Integer, ForeignKey('users.id'), primary_key=True))
Whether or not a particular user id appears in the user_id column or friend_id column, I want that row to count in the relation.
so: >>> user1.friends.append(user2) >>> user1.friends [ <User: 2> ] >>> user2.friends [ <User: 1>]
friendship table: ----------------------- | user_id | friend_id | ----------------------- | 1 | 2 | ----------------------- Thanks, Michael Carter------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo Sqlalchemy-users mailing list |
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users