On Saturday 07 June 2008 21:35:35 Tomer wrote:
> If I am just issuing a read-only query, and I want to make sure
> that nothing will change in the middle, do I need a transaction? If
> so, what do I do with it when I'm done - commit or rollback?
>
> For example, I want to do this:
>
> for user in Session.query(User):
>     print user.name
>
> Should I use a transaction like this:
>
> Session.begin()
> for user in Session.query(User):
>     print user.name
> Session.commit()
> If not, how would I deal with this if my session (created with
> scoped_session) is transactional?
if the __str__ happens to self-change (well, shit happens), then u 
should not do commit nrt flush. the safest is to rollback - 
regardless what u do. or maybe close() or clear()?
i think there was some way to make the session readonly alltogether -- 
but i'm not sure.

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