On Feb 14, 5:38 pm, Michael Bayer <[email protected]> wrote: > this looks like nid/vid should comprise a composite primary key ? is > there a reason that's not considered here ?
I guess a composite primary key would make sense. I'm hesitant to alter the table since it might cause problems when the application which created it is updated, but let's just say at this stage I'm more than willing to just do it if it means I can make this work. > 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. No, just on nid (for an explanation on why, see below). I tried defining an inherit_condition on the mapper though to see how this would work but I couldn't make it work. Could you give an example? > 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. The uc_products table is used both for storing the most current revision as previous revisions (it functions somewhat as a joined node/node_revisions table), contrast that with the node table which only stores the vid of the latest revision associated with the node. So the uc_products table might look like: +-----+-----+ | vid | nid | +-----+-----+ | 1 | 1 | +-----+-----+ | 2 | 1 | +-----+-----+ | 3 | 2 | +-----+-----+ While the node table would only look like (note that there is no row with 2 as the vid): +-----+-----+---------+ | nid | vid | type | +-----+-----+---------+ | 1 | 2 | product | +-----+-----+---------+ | 2 | 3 | product | +-----+-----+---------+ Thanks for all the help, I really appreciate it. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
