OK thanks that what I missed...... Thanks On Feb 15, 9:19 pm, "Gary Bernhardt" <[EMAIL PROTECTED]> wrote: > On 2/15/07, dischdennis <[EMAIL PROTECTED]> wrote: > > > > > Thats the problem. > > I know that it is possible to add unique = True for each column. But > > then it is not possible to assign combinations of budget / cost > > centers like (1,1)(1,2)(1,3)...etc... > > So I would like to define both primary keys, the complete primary key > > together as unique. Thats what I tried with the UniqueConstraint. But > > it checks only for the contraint itself. I would have to reference on > > the complete primary key not only on the single column. but how to do > > this with sqlalchemy? > > You can define multi-column foreign keys with ForeignKeyConstraint. > Search for it athttp://www.sqlalchemy.org/docs/metadata.myt. > > So there is no solution to get it running with this requirement in > > > postgresql ? (except defining a new ID but I cannot change the schema) > > > On 15 Feb., 21:03, "Gary Bernhardt" <[EMAIL PROTECTED]> wrote: > > > The pr_PurchaseRequisition_has_CELLS_budget_has_CELLS_costCenter table > > is > > > the one that's causing your problem. It has a foreign key to > > > CELLS_budget_has_CELLS_costCenter.CELLS_budget_ID (and another to > > > CELLS_costCenter_ID on the same table). Neither of those > > > two columns are unique. If you add unique=True to both of their > > > definitions, SA will succeed in creating the tables. > > > It will fail later, though - > > > you apparently insert rows where those columns really aren't unique. > > > > On 2/15/07, dischdennis <[EMAIL PROTECTED]> wrote: > > > > > Sorry, I placed the testcase here: > > > > >http://groups.google.de/group/sqlalchemy/web/testcase_dischdennis_Pos. > > .. > > > > > I could not find a way to upload it with the message directly. > > > > > Dennis
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---