On Saturday 07 June 2008 22:50:36 Tomer wrote:
> Thanks. What would happen if I didn't do anything (I've seen lots
> of examples online that will just issue a query like
> Session.query(User).all() and that's all). Will that query start a
> transaction if it's a transactional session?
no idea, never used those, see docs.
as long as u know your objects, these things should be fine. But if 
it's not _your_ objects and/or u expect anything from those or u're 
paranoic about the db safety... open it with readonly access?

> On Jun 7, 11:58 am, [EMAIL PROTECTED] wrote:
> > 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