Dear Gennady,

I'm afraid flushing is your only option, as you need the next number
from the database sequence. What I do is flushing some objects in
their init methods already.

Kindest regards,

Koen Bok

On Aug 19, 7:22 am, Gennady <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm a new sqlalchemy user. I have a question about generate id.
>
> I have a class with __init__ method, and after some initialization
> __init__ call events. Event handlers must know about id of new object.
>
> But if I use Sequence I don't know about new id in __init__ method
> before I flush changes to the database. And I can have two or more
> processes that connect to database. If I generate id in python may be
> a conflict on save objects in two processes.
>
> What is right way to resolve this problem? How to generate id and use
> transactions?
>
> Thank you.
>
> Gennady.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to