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 UTC+4:30, Mohsen Pahlevanzadeh 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?*
>
>

-- 
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.

Reply via email to