the column with the Sequence looks fine. All the other primary key columns in the other tables don't have a sequence though, and those will cause an error on INSERT unless you explicitly specify a primary key value.
The stack trace here will potentially shed more light on the specifics. On Feb 19, 2013, at 11:30 AM, Mauricio de Abreu Antunes <[email protected]> wrote: > Michael, > > Thanks for your support. > > My schema is declared here: > https://gist.github.com/mauricioabreu/b605d0704658c185595f > > Sequence("SEQ_CUSTOMER_ID") is a declared sequence that I created in the > Oracle instance. > I know that there is a way to build Sequences on runtime, but I am not sure > if that is the best way to go. > > 2013/2/19 Michael Bayer <[email protected]> > > That effect wouldn't be possible without additional things going on in your > application, such as if you were assigning some value to the primary key > attribute or you had some mechanics with relationship() going on such that > your primary key attribute were also being affected by other object > references. > > I can easily show you a short example application that will illustrate an ORM > object working in conjunction with a Sequence and it will work every time, so > you'd have to provide detail on specifics here. Ideally a short test case > that can actually be run, but at the very least the mappings in question. > > > > On Feb 18, 2013, at 11:40 PM, Mauricio de Abreu Antunes > <[email protected]> wrote: > >> Thanks Michael! >> >> I'm getting this error "FlushError: Instance has NULL identity". >> But the strange thing it is not happening every time my insert runs. >> It looks like the sequence is generating the value after the commit, so ID >> is null. >> >> On Tuesday, February 19, 2013 12:42:04 AM UTC-3, Mauricio de Abreu Antunes >> wrote: >> How to use Sequence with SQLAlchemy? >> >> Oracle does not support autoincrement, so I tried to use Sequence >> (sqlalchemy.schema) like: >> >> id = Column(Integer, Sequence("seq_customer_id"), primary_key=True) >> >> but it is not working. >> >> If you need more info to help me tell me then i back here to post it. >> >> Thanks in advance. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sqlalchemy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > Mauricio de Abreu Antunes > Mobile: (51)930-74-525 > Skype: mauricio.abreua > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
