No, the association proxy would be used if you want to let users directly 
access movies or vice versa. To get the score, you can define a mapper for 
movie_vote table and define relationships between it and users and movies.

Barry

----- Original Message ----
From: Jason <[EMAIL PROTECTED]>
To: sqlalchemy <sqlalchemy@googlegroups.com>
Sent: Tuesday, October 23, 2007 7:10:15 PM
Subject: [sqlalchemy] In a many to many relationship how to access some 
properties of that relationship



Greetings,

for my model I have this:

user_table=Table("users", metadata,
    Column("id", Integer, primary_key=True),
    Column("gender", Unicode),
    Column("age", Integer, ForeignKey("ages.id")),
    Column("occupation", Integer, ForeignKey("occupations.id")),
    Column("zipCode", Integer(5))
)

movie_table=Table("movies", metadata,
    Column("id", Integer, primary_key=True),
    Column("title", Unicode)
)

movie_vote_table=Table("movie_votes", metadata,
    Column("id", Integer, primary_key=True),
    Column("user", Integer, ForeignKey("users.id")),
    Column("movie", Integer, ForeignKey("movies.id")),
    Column("score", Float)
)

I've of course left out some of the other tables that weren't needed
for this question

so I of course a many to many relationship between the users and the
movies they have rated. but the only problem is how do I access that
score?

It would be cool to have something like User.movies[0].score,
User.movies[1].score .. etc.
is this something I would want to use the association proxy for?
-Jason








__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
--~--~---------~--~----~------------~-------~--~----~
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