Re: [SQLObject] destroySelf() Documentation Delete
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Nigel K. <Ki...@di...> - 2005-01-31 17:10:00
|
Ian, Thanks very much-sorry for the double posting. Great program Nigel King On 31 Jan 2005, at 12:05, Ian Bicking wrote: > Nigel King wrote: >> Hi, >> Thanks for a great program. I could not find any documentation on how >> to delete a record or multiple records. Am I correct in the >> following? >> # in order to delete all records with the lastName of "Doe" >> p=Person.select(Person.q.lastName="Doe") >> p.destroySelf() > > You'd have to do: > > for p in Person.select(Person.q.lastName="Doe"): > p.destroySelf() > > You basically have to go through them one-by-one. In the future the > classmethod .delete() will be extended to call .destroySelf() only if > the object is already loaded in memory, and otherwise just call it on > the database; and from there .select() will be changed to have an > option to return just IDs instead actual objects, so you can do > deletes without having to temporarily load objects into memory. But > for now you have to go about it the long way. > > -- > Ian Bicking / ia...@co... / http://blog.ianbicking.org > |