[sqlalchemy] Re: sqlalchemy.exc.InvalidRequestError: Instance 'MYCALSSTABLENAME at 0x994a90c' is not persisted

2013-08-27 Thread Mohsen Pahlevanzadeh
My ddd object : ddd = SellersTable(dict([('name_type',1) ])) dbObj.deleteRecord(ddd); SellersTable is a class table that contains __tablename__ and fileds name. I pass a dictionary that consist of my field and its value. I chekced, it stored in DB. On Tuesday, August 27, 2013 2:47:46 AM

Re: [sqlalchemy] Re: sqlalchemy.exc.InvalidRequestError: Instance 'MYCALSSTABLENAME at 0x994a90c' is not persisted

2013-08-27 Thread Simon King
session.delete() only works with instances which are already part of that session. Here's an example: ddd = session.query(SellersTable).filter_by(name_type=1).one() session.delete(ddd) This will SELECT the row from the database first, then perform the DELETE using the object's primary key.