n00b wrote:
> why don't you work off the las/previous committed rec id?
>
> On Jan 29, 4:05 am, Dejan Mayo <[email protected]> wrote:
>   
>> Hi,
>>
>> My code is like that:
>>
>> try:
>>     for some_val in some_values:
>>         rec = SomeModel()
>>         rec.some_val = some_val
>>         session.save(rec)
>>     session.commit()
>> except:
>>     session.rollback()
>>
>> For each record that I'm creating, I need to send an email right
>> after. And each email includes some data about these records,
>> especially the "rec.id". Everything looks fine but the problem is
>> getting the "rec.id".
>>
>> I've tried:
>>
>> try:
>>     for some_val in some_values:
>>         rec = SomeModel()
>>         rec.some_val = some_val
>>         session.save(rec)
>>         email(rec=rec) # rec doesn't have "id" yet so it doesn't work
>>     
what about doing:
                        session.flush()
here?

Werner

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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