Hello,

I'm using the declarative extension and was wondering (after searching
the docs) how to elegantly delete multiple objects at once, preferably
without loading them in first. Suppose you've got a mapped class like
this:
class Person(Base):
  __tablename__ = 'persons'
  stamp = sa.Column(sa.DateTime)
 ...

Now you could delete multiple objects like this (I think):
Person.__table__.delete().where(stamp < somedate)

or like this with loading all objects:
persons = session.query(Person).filter(Person.stamp < somedate)
for person in persons:
  session.delete(person)

Is there something like session.delete(Person).filter(Person.stamp <
somedate) ?? i.e. something similar to the session.query construct but
instead of selecting performing a delete?

Regards,
Ids
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to