On Nov 6, 2007, at 12:20 PM, Werner F. Bruhin wrote:

>
> I insert a raw into a table and then retrieve again but columns which
> are filled by a db trigger don't return the updated values.
>
> The following is a code snippet and I wonder what I am missing.
>
> engine = sa.create_engine(url, encoding='utf8', echo=False)
> Session = sao.sessionmaker(autoflush=True, transactional=True)
> Session.configure(bind=engine)
> session = Session()
> botlot = db.Bottaglot()
> session.save(botlot)
> session.commit()
>
> print 'org'
> print botlot.bottaglotid
> print botlot.updated
>
> botlot2 = session.query(db.Bottaglot).get(botlot.bottaglotid)
> print 'reloaded'
> print botlot2.bottaglotid
> print botlot2.updated
>
> Both columns "updated" will show None instead of at least for  
> botlot2 it
> should show the current date which was inserted into that column by  
> a db
> trigger.
>

set a PassiveDefault on the triggered column.  that will indicate to  
the mapper that it should post-fetch the value after an insert. note  
that if the trigger is on a primary key column, it wont work since we  
need primary key values in order to post-fetch.


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