I am trying to define a colleagues association table that can be used to notify people when there colleagues make changes. Think of it as a Facebook "followers" type of thing.
The relationship is not necessary inverse. I may follow James Watson, he might not (yet) follow me. ;-)
Anyhow, here is where I am at, but SQL Alchemy wants a fully bidirectional relationship and complains
Colleague_Association.table = Table( "colleague_association", metadata,
Column( "id", Integer, primary_key=True ),
Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
Column( "colleague_user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ) ,
Column( "deleted", Boolean, default=False )
)
assign_mapper( context, Colleague_Association, Colleague_Association.table,
properties=dict( user=relation( User, backref="colleagues" ),
colleague=relation( User ) ))
There are examples on the web for doing this in more recent versions of SQLAlchemy, but I can't find one that uses the (now deprecated) assign_mapper method.
Any ideas?
Thanks,
Ted