Hi, I am working on a wxPython application that saves data to various tables in our MS SQL Server 2000. I connect to one table and get data using a session. This works great. I then do a session.close() and then a conn.close() where conn = engine.connect(). This seems to work as expected as well. The problem happens when I connect to the second table. I get the data from the second table just fine, but when I try to update it using my 2nd session object, I get the following error:
Traceback (most recent call last): File "\\debianis\loginscript$\PythonPackages\Development\Timesheet_sa \ts_worksheet_MT.py", line 689, in onClose session.flush() File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\orm\session.py", line 789, in flush self.uow.flush(self, objects) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\orm\unitofwork.py", line 233, in flush flush_context.execute() File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\orm\unitofwork.py", line 445, in execute UOWExecutor().execute(self, tasks) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\orm\unitofwork.py", line 930, in execute self.execute_save_steps(trans, task) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\orm\unitofwork.py", line 945, in execute_save_steps self.save_objects(trans, task) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\orm\unitofwork.py", line 936, in save_objects task.mapper._save_obj(task.polymorphic_tosave_objects, trans) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\orm\mapper.py", line 1144, in _save_obj c = connection.execute(statement.values(value_params), params) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\engine\base.py", line 844, in execute return Connection.executors[c](self, object, multiparams, params) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\engine\base.py", line 895, in execute_clauseelement return self._execute_compiled(elem.compile(dialect=self.dialect, column_keys=keys, inline=len(params) > 1), distilled_params=params) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\engine\base.py", line 907, in _execute_compiled self.__execute_raw(context) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\engine\base.py", line 916, in __execute_raw self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\engine\base.py", line 960, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor) File "c:\python25\lib\site-packages\sqlalchemy-0.4.7-py2.5.egg \sqlalchemy\engine\base.py", line 942, in _handle_dbapi_exception raise exceptions.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) sqlalchemy.exceptions.DatabaseError: (DatabaseError) internal error: None 'UPDATE [tbl_Acct_Prefs] SET pref_value=%(pref_value)s WHERE [tbl_Acct_Prefs].[empID] = %(tbl_Acct_Prefs_empID)s AND [tbl_Acct_Prefs].pref_name = % (tbl_Acct_Prefs_pref_name)s' {'pref_value': u'4', 'tbl_Acct_Prefs_pref_name': 'last_payPeriod', 'tbl_Acct_Prefs_empID': 258} To get the data, I do the following: pref = session.query(Acct_Prefs).filter_by(empID=self.emp_id, pref_name='last_payPeriod').first() Then I change a value like this: pref.pref_value = someValue Finally, I do a session.flush() and session.commit(). I've tried using just a commit(), but I get the same error. Since I can run this second session by itself in IDLE, I think the 1st session or connection or something is somehow messing up the second one. Any ideas on what is going on would be great. I'm still pretty green with SA, by the way. I am developing on Windows XP, Python 2.5.2 and using SqlAlchemy 0.4.7. I can upgrade if you guys think that's the issue. Thanks, Mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---