I don't know what "wx.GetApp().ds" is, but a "commit", assuming this is a
Session, will return the current connection back to the connection pool, and
any session changes stay with that connection. Using the Session again will
pull up a potentially different connection.
if you want to make per-connection changes across multiple transactions, you'd
need to hold onto the connection for that scope:
conn = engine.connect()
conn.execute(" set whatever state you need here")
session = Session(bind=conn)
# use the session, commit, whatever
session.close()
conn.execute("reset whatever state you need here")
conn.close() # returns DBAPI connection to the connection pool and/or closes
the DBAPI connection
On Apr 29, 2013, at 10:38 AM, Werner <[email protected]> wrote:
> Hi,
>
> I think I fixed it but don't understand at all why my change would fix it.
>
> getcont = "select rdb$get_context('USER_SESSION', 'LANGUAGE_ID') \
> from rdb$database"
> setcont = "select rdb$set_context('USER_SESSION', 'LANGUAGE_ID',
> %s) \
> from rdb$database" % self.loggedInUser.language.id
>
> # set language for this connection for localization stuff
> x = wx.GetApp().ds.execute(setcont).fetchone()
> y = wx.GetApp().ds.execute(getcont).fetchone()
> assert y[0] == str(self.loggedInUser.language.id), \
> "User session lang problem y = %s, id = %s" % (y,
> self.loggedInUser.language.id)
> wx.GetApp().ds.commit()
>
> If I change the application init code above to NOT do the commit at the end
> it works, even if later on in the application commits are issued it still
> keeps working.
>
> Can someone please explain why the above commit would someone cause the
> context not to stick.
>
> Werner
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.