On Jan 23, 2008, at 4:24 PM, Monty Taylor 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 ...
>

If you're asking about creating mappers, a many-to-many table has  
exactly two foreign keys defined, that of a parent table and a child  
table.  Any columns which are not part of those two foreign keys  
disqualifies the table to be considered a many-to-many table by  
SQLAlchemy's ORM; youd have to map a class to the table explicitly.

if youre just talking about adding a column to a Table, i think theres  
an "append_column()" method which does that....(check the docstrings)



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