Andreas Jung wrote:
> In a traditional application you can insert a new row and read the row
> within the same transaction. What is the typical usage pattern to deal
> with this in SA? In our particular setup (Zope) a new session is
> created for
> each new HTTP request and flushed automatically at the end of request
> when
> Zope commits the transaction. A solution might be to flush the session
> explicitly in such a case however I don't think that this is a smart
> idea.
> Any better idea?
You can call session.flush() in between. This writes to the transaction
but does not commit anything yet

If you need to directly query the tables afterwards (triggers, text
query, whatever), but inside the same transaction:

session.flush()
conn = session.context.get_current().connection(SomeMappedClass)
conn.execute(sa.select(...)...)



(at least, works for me with turbogears that wraps requests with
transactions the same way as zope)


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