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 
<mauricio.abr...@gmail.com> 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 sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> 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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to