On Feb 14, 2008, at 6:01 PM, Waldemar Osuch wrote:
> > > > On Feb 14, 2:06 pm, Richard Jones <[EMAIL PROTECTED]> wrote: >> On Feb 14, 5:13 pm, Waldemar Osuch <[EMAIL PROTECTED]> wrote: >> >>> On Feb 13, 8:03 pm, Richard Jones <[EMAIL PROTECTED]> wrote: >> >> Thanks, I should have been clearer: how is ID generation done when >> there is no sequence assigned to the column? >> > > Then my guess is that the generation does not happen and you have > to provide the value of the ID yourself. > One could have an insert trigger doing the work but then SA > would not know about the new ID and you would have to flush, clear > and requery before being able to add related record. > > Any particular reason you do not want to specify the Sequence > in the definition? > > Anyway enough with the guesses. > Time for an expert to step in :-) if you wanted to use a trigger or something, the issue with Oracle specifically is that cx_oracle provides no way of immediately retreiving a newly generated primary key default. So we use sequences so that the sequence can be pre-executed before each INSERT and we then have the new ID. If you had some other function which generates an ID that can also be specified using a ColumnDefault object; but the limitation is that it needs to be something which can run standalone (i.e. not solely a trigger on the table). Also with Oracle we don't any "implicit" id generation scheme; you have to give it something explicitly, either a sequence, ColumnDefault, or always provide primary key identifiers explicitly in the INSERT parameters. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---