On Feb 14, 2009, at 5:59 AM, Bruce van der Kooij wrote:

> Michael Bayer wrote:
>> which two tables are concrete ?  I dont see the "concrete=True"  
>> keyword
>> used in your mapping setup, but then again I don't see the "inherits"
>> keyword either
>
> Sorry, I think I accidentally edited that out before posting. Though I
> did indeed have a polymorphic_identity without having concrete  
> specified
> to True, so thanks for pointing out that this doesn't actually do
> anything (I had foolishly assumed it was required to make sure the  
> type
> in the node table was filled correctly).
>
> The problem is that if on the uc_products table vid is set is a  
> primary
> key (and not nid as it is for the parent node table) a creation of a
> Product results in the following rows:
>
> node:
> +-----+-----+---------+
> | nid | vid | type    |
> +-----+-----+---------+
> | 1   | 1   | product |
> +-----+-----+---------+
>
> node_revisions:
> +-----+-----+
> | nid | vid |
> +-----+-----+
> | 1   | 1   |
> +-----+-----+
>
> uc_products:
> +-----+-----+
> | vid | nid |
> +-----+-----+
> | 0   | 1   |
> +-----+-----+
>
> Note how vid for uc_products remains on the default value (0). The
> mapping below would work if nid was the primary key for the  
> uc_products
> table instead of vid:

this looks like nid/vid should comprise a composite primary key ?  is  
there a reason that's not considered here ?

does uc_products join to node based on both nid/vid?  if so, the join  
condition can be configured on the mapper so that both would be  
properly populated through the inheritance mechanism regardless of  
primary key or foreign key status.

also if node.vid is a foreign key to node_revisions.vid, its still  
probably more appropriate for uc_products.vid to be a foreign key to  
node.vid, since thats what its dependent on most directly.




--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to