hey there -

i just found another issue which may be the problem youre having on  
this.  if you try rev 2428 i think that might fix your issue (but  
also, your "tags" relationship below might also need to be declared  
"viewonly=True" since im not sure if it can be flushed).


On Mar 16, 2007, at 4:12 AM, Mel Collins wrote:

>
>  In my project, I have users, who receive messages, which can be
> assigned any number of 'tags'. (In the same manner as Gmail's labels)
> I've got (amongst others) the following tables:
> - UserMessages (userId, messageId, ...)
> - UserMessageTags (userId, messageId, tagId)
> - UserTags (userId, tagId, ...)
>
>  What I'm trying to do is make all UserTags rows available in the
> UserMessages objects. At the moment I have:
> orm.mapper (UserMessages, userMessagesTable
>               ,properties={
>                                'tags': orm.relation(UserTags
>                                               ,secondary=userMessageTagsTable
>                                               ,primaryjoin=sql.and_(
>                                                                
> userMessagesTable.c.userId==userMessageTagsTable.c.userId
>                                                               
> ,userMessagesTable.c.messageId==userMessageTagsTable.c.message 
> Id
>                                                               )
>                                               ,secondaryjoin=sql.and_(
>                                                                
> userMessageTagsTable.c.userId==userTagsTable.c.userId
>                                                               
> ,userMessageTagsTable.c.tagId==userTagsTable.c.tagId
>                                                               )
>                                               ,lazy=False
>                                               ,uselist=True
>                                               )
>                               }
>               )
>
> This works find for reading in the data, but when I attempt to remove
> an entry from the list:
> userMessage.tags.pop()
> session.flush()
> I get an:
> sqlalchemy.exceptions.InvalidRequestError: Column
> 'userMessageTags.userId' is not available, due to conflicting property
> 'userId':<sqlalchemy.orm.properties.ColumnProperty object at
> 0xb75ba2ac>
>
>  When I changed the primaryjoin and secondaryjoin conditions to only
> use messageId and tagId, respectively, it worked as expected. Changing
> them to both only use the userId columns caused the same
> IvalidRequestError.
>
>  Is this a bug in SA, or in my implementation (which, admittedly, is
> usually the case :) )?
>
>  Takk,
>  - Mel C
>
>
> >


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