On Sun, Oct 11, 2009 at 4:35 PM, Michael Bayer <[email protected]>wrote:
> > > On Oct 11, 2009, at 9:32 AM, Nicol van der Merwe wrote: > > > Hi All > > > > I am using sqlsoup and pyodbc to update a couple of rows in the > > database. On a number of tables in the database I have triggers that > > basically checks keeps a log of changes on certain columns in the > > table (inserts changes into another table). My problem is that I am > > unable to update values on tables that has this trigger. No error/ > > warning is thrown, it just fails silently. When I disable the > > triggers the updates work fine. Also, if I run the update statement > > directly on the database it works as expected, whether it's run with > > or without the triggers. > > the main issue with your script is that the work you are doing with > "connection" and "trans" is meaningless versus the operation you are > performing on your objects. SQLSoup uses the ORM so you need to be > using the Session to control transactional scope - this is documented > here: http://www.sqlalchemy.org/docs/05/session.html . I think for > SQLSoup itself its sufficient to say db.commit(). > > beyond that, if there is truly a different behavior when the trigger > exists versus does not, the next meaningful test is to try your use > case with a raw pyODBC script. At that point its likely an ODBC > related issue. > > > > Hi Michael I did as you suggested and tried the session - and it didn't work. According to the documentation, pyodbc is the preferred module for sql server so up until now I had just tried that. As a last resort I tried pymssql - and it worked(!). Even if I directly issue the updates using pyodbc, it fails - whereas the same update succeeds with pymssql. Could this mean that the issue lies with pyodbc? I am going to try and put together a test so prove that this is indeed a bug and submit it to the pyodbc guys. Maybe I can even write a patch to fix this. I need to investigate it a bit further though as I'm a bit pressed for time and need my application just working for now. Thanks for your help though. Regards -- Nicolaas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
