Lukasz Szybalski ha scritto: > I am trying to insert a record with a compound primary key that consists of > Team_Sid, User_Sid > > I can either do > > i = users_table.insert() > i.execute(TEAM_SID=343, USER_SID=1,TEAM_NAME='the team') > i.execute(TEAM_SID=343, USER_SID=2,TEAM_NAME='the team') > i.execute(TEAM_SID=343, USER_SID=3,TEAM_NAME='the team') > > But that means I need to find out what is the next USER_SID available. > > Is there an insert save or other function that will save the record > and auto number the second primary key TEAM_SID=343 + autonumber >
Just to be picky, there is no such thing as a _second_ primary key, it's a part of the compund PK. > User_sid ?? > i.execute(TEAM_SID=343,TEAM_NAME='the team') > Your post begs for a question, which is "why?" :-) You are fighthing the system. Having an autonumber column as part of a compound key does not make a lot of sense. I don't think you have a really, really, really strange use case that justifies it. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---