Hi, Here's what I'm doing. I have a timesheet application written in wxPython. It works, but I think it would work better if I changed the database calls into SA calls. There are 3 databases. I created one and the other two are pre-existing. The one I created is the one I store all the user entered data into. I read from the official accounting database and I read from a couple of views in the third database. The two databases I read from are for checking purposes to make sure that I am doing the calculations correctly in my program and also for authentication and certain bits of user data, such as employee number, name and such.
Anyway, I dumped the close calls I had and put them in the OnExit method, which is something I've never used before. I'm not sure that I have that set up right, but at this point it doesn't matter. I am still receiving the same error. If I take all of my SA setup out of the wxPython code and stick it in my own module, it works. Here's what that looks like: <code> import ts_info from db_tables import Acct_Prefs, TimeEntries from sqlalchemy import Table from sqlalchemy.orm import mapper, sessionmaker # Connect to the database print 'connecting to MCISAccounting DB...' conn, engine, meta = ts_info.setupDB('acct') # Load the tables print 'loading tables...' entry_table = Table('tbl_TimeEntries', meta, autoload=True) prefs_table = Table('tbl_Acct_Prefs', meta, autoload=True) # Map the tables print 'mapping tables...' mapper(TimeEntries, entry_table) mapper(Acct_Prefs, prefs_table) # Create a session object print 'creating session...' Session = sessionmaker(bind=engine) session = Session() pref = self.session.query(Acct_Prefs).filter_by(empID=self.emp_id, pref_name='last_payPeriod').first() pref.pref_value = SomeValue self.session.commit() </code> For some weird reason, if I do those last three lines in one of my wxPython methods, I get an error. I know it has to be something really stupid, but I'm just not seeing it... Mike On Aug 28, 10:29 am, "Werner F. Bruhin" <[EMAIL PROTECTED]> wrote: > Mike, > > Mike wrote: > > ... > > > Does this work for multiple databases? This particular program I am > > working on will be connecting to 2 or 3 databases and a table or three > > in each of those. I'm pretty sure I have to create separate engines > > for each db and probably bind separate sessions for those. > > I don't think so, using sessions and engines I would think you have to > have one per database. > > You probably need to explain a bit more what you are doing with these > databases, i.e. are you moving data from one to the other, or are they > independent databases or ...... > > Werner --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---