Re: [SQLObject] Updating with Join fields - Answer
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Brian B. <br...@ab...> - 2005-08-19 05:38:24
|
Hello all, Ok, the deal seems to be, (from looking at the source), that the delete() method is only designed to delete one record, and NOT to be used like a select() is. My solution wound up being: @classmethod def deleteRecsForWeek(klass, aDate, aPerson): from sqlobject.sqlbuilder import Delete delete = Delete("time_record", where= AND(klass.q.workDate >= str(aDate), klass.q.workDate <= str(aDate+6), klass.q.personID == aPerson.id)) s = klass._connection.sqlrepr(delete) return klass._connection.query(s) And it works flawlessly. However, I think that delete should work like select, so is anyone else interested in this? If so, I'll take a shot at adding it! Any thoughts? Brian On Aug 10, 2005, at 12:57 PM, Brian Brown wrote: > > On Aug 10, 2005, at 11:17 AM, michelts wrote: > > > >> >> A person is a instance of the Person table? If you use a integer (a >> valid id for the Person table), did it work? Can you try to do a >> select with the same syntax? >> >> > > Yes, a person is an instance of the Person table, which posted the > definition of in this thread. > > I have another method: > > @classmethod > def selectRecsForWeek(klass, aDate, aPerson): > print aPerson > return klass.select( > AND(klass.q.date >= str(aDate), > klass.q.date <= str(aDate+7), > klass.q.personID == Person.q.id, > Person.q.id == aPerson.id)) > > > and it works without fail. Same and clause, so I don't get it, > unless it's something in the delete() method. > > > > >> >> regards, >> -- >> Michel Thadeu Sabchuk >> Curitiba - Brasil >> >> >> > > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle > Practices > Agile & Plan-Driven Development * Managing Projects & Teams * > Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/ > bsce5sf > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > > |