Hi everybody,

I'm new with SQLAlchemy and I'm trying to understand better the Session
object.

First of all, why the expire_all() exists? Shouldn't it be always better to
expunge_all() instead? If it is expired, at the use of the instance another
query would be issued to reattach it anyway, so why keep "useless" instances
in the identity map (maybe i'm wrong about this fact, i dont know exactly
how the identity map works).

Second, when we should call the close() method? I dont think if i get it at
all. Let's say that I have the following DAO:

PersonDAO:
    def insert(self, person):
         session = Session()
         session.add(person)
         session.commit() // why the commit starts a new transaction?
should'n it only start again the next database access?
         session.close() // is it necessary?

Is the a Session instance directly associated to a Connection in the pool?
With the default pool size of 5, after 5 call of the insert method, the
connection_overflow would be used? What's the time to a Session "expire"?

And just to finish. Why do we use remove() for the scoped_session instead of
the close()? Shouldn't it be semantically identical only overrided for the
contextual stuff?

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to