Sqlalchemy: querying table in different functions gives different results

2009-02-17 Thread Bryan
1. Client calls login(), a new row is inserted in the token table. 2. Client calls anotherFunction and the new row is not visible inside that function 3. If I place a Session.commit() in anotherFunction, then I can see the row def login(self, user, pass): ' Create new login entry that gives

Re: Sqlalchemy: querying table in different functions gives different results

2009-02-17 Thread Wichert Akkerman
Previously Bryan wrote: 1. Client calls login(), a new row is inserted in the token table. 2. Client calls anotherFunction and the new row is not visible inside that function 3. If I place a Session.commit() in anotherFunction, then I can see the row def login(self, user, pass): '

Re: Sqlalchemy: querying table in different functions gives different results

2009-02-17 Thread Brennan Todd
Which database are we talking about here? On Tue, Feb 17, 2009 at 2:13 PM, Bryan bryanv...@gmail.com wrote: It is called in a separate web request. I am using scoped_session, so if the 2 requests were on the same thread, they should use the same session. I don't think the 2 requests are on

Re: Sqlalchemy: querying table in different functions gives different results

2009-02-17 Thread Bryan
MySQL. According to the Lifespan of a Contextual Session section @ http://www.sqlalchemy.org/docs/05/session.html#contextual-thread-local-sessions Each web request should be getting a new session. That makes sense, I am calling Session.remove() at the end of the WSGIController.__call__ () I am

Re: Sqlalchemy: querying table in different functions gives different results

2009-02-17 Thread Bryan
SOLVED: I mentioned in my first post that I was using the XMLRPCController. Well, in my BaseController that inherits from WSGIController, I properly call Session.remove() at the end of each request, which gets rid of the session completely, and each request starts with a new fresh session.