Good Day sqlalchemy. I was searching, but didn't found a way to delete records from db not executing selection first.
So, how to represent this SQL statement in slqalchemy ORM : """ DELETE FROM a WHERE b = c """ ? not it look like this : stuff = session.query(A).select_from(a_table).filter(A.c.b==c).first() session.delete(stuff) P.S. How to understand the following : Traceback (most recent call last): File "threading.py", line 442, in __bootstrap self.run() File "./camper.py", line 173, in run session.delete(stuff) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/scoping.py", line 74, in do return getattr(self.registry(), name)(*args, **kwargs) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 849, i n delete self._delete_impl(object) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", line 1007, in _delete_impl raise exceptions.InvalidRequestError("Instance '%s' is not persisted" % mapp erutil.instance_str(obj)) InvalidRequestError: Instance '[EMAIL PROTECTED]' is not persisted It occurs sometimes in threaded application in this code : """ from sqlalchemy.orm import mapper, relation, backref, create_session, scoped_session session = scoped_session(create_session) stuff = session.query(Path).select_from(f_table.join(u_table)).filter(User.c.id==theone.id).first() session.delete(stuff) """ --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---