On Mon, Aug 26, 2013 at 11:17 PM, Mohsen Pahlevanzadeh <m.pahlevanza...@gmail.com> wrote: > Dear all, > > > i have the following delete record function: > > def deleteRecord(self,tableObj): > self.session.delete(tableObj); > self.session.commit(); > > > When i call the abobe function, before commit(), i get the following > traceback: > > Traceback (most recent call last): > File "./main.py", line 66, in <module> > main() > File "./main.py", line 53, in main > dbObj.deleteRecord(ddd); > File "/home/mohsen/projects/amlak/dbabslayer/dbabslayer.py", line 86, in > deleteRecord > self.session.delete(tableObj); > File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line > 1437, in delete > orm_util.state_str(state)) > sqlalchemy.exc.InvalidRequestError: Instance '<SellersTable at 0x994a90c>' > is not persisted > > dbabslayer class have a set of function such as deleteRecord, addRecord, > createEngine, createSession and so on. > SellersTable is class name of sellers table. > > Where's Problem? >
It sounds like you are trying to delete an entry which you've never stored in the database. Where are you getting your "ddd" object from? Simon -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.