Re: [SQLObject] Need help with inserting new rows
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Madhuri N. <ma...@sc...> - 2005-02-16 04:56:42
|
Ian Bicking wrote: > Madhuri Neerukonda wrote: > >> Hi all, >> I am a newbie to sqlobject. So be patient with me. i have >> installed sqlobject 0.6.1-1. My underlying database is MySql. So far >> it is working great . But the problem comes while inserting new rows >> into a table. I followed exactly the way it is mentioned in docs but >> it is throwing the following error > > > Hopefully someone can offer up a more detailed explanation, but this > is a problem with the MySQLdb version you are using. Either old > versions have a lastrowid and new versions don't, or the other way > around. I thought this was fixed though, but it's hard to test > multiple versions of the supporting libraries so I guess not. > Hi Again, Thanks for those inputs. It made me examine cursors.py source code of MySQLdb 0.9 and to my dismay i found there is no 'lastrowid' attribute. After a quick go thru in MySQL Reference manual , i gathered that i have to use insert_id(). Went back to sqlobject/mysql/mysqlconnection.py and changed line 57 to id = c.insert_id(). After this row insertion is fine. Can someone assure me that doing like this is ok and will not give headaches in the future Cheers Madhuri |