On Jan 23, 2008 10:24 PM, Monty Taylor <[EMAIL PROTECTED]> wrote:
>
> This may or may not be elixir specific...
>
> If I have an auto-generated mapping table for a many-to-many
> relationship, is there a sensible way to add another column to it that's
> also has a foreign key relationship to a third table?
>
> Like, if I had this:
>
> Products
>   id int
>   name varchar
>
> ProductTypes
>   id int
>   name varchar
>
> Groups
>   id int
>   name varchar
>
> and then I defined a many to many between products and groups to get
>
> products_groups
>   product_id
>   group_id
>
> and I wanted to add producttype_id to that ...

You'll probably want to use the Association Object pattern, as described at:

http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_relation_patterns_association

And possibly, the AssociationProxy plugin, at:

http://www.sqlalchemy.org/docs/04/plugins.html#plugins_associationproxy

This one can be used with Elixir just fine. You just need to import it
from SQLAlchemy:

from sqlalchemy.ext.associationproxy import AssociationProxy

-- 
Gaƫtan de Menten
http://openhex.org

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