def execute_delete(self, query):
        table = query.model._meta.db_table
        ## the root where node's children may itself have children..
        def recurse_for_pk(children):
            for node in children:
                if hasattr(node, 'rhs'):
                    pk = node.rhs[0]
                else:
                    try:
                        pk = node[-1][0]
                    except __HOLE__:
                        pk = recurse_for_pk(node.children)
                return pk
        pk = recurse_for_pk(self.query.where.children)
        assert pk
        url = self.session.auth.instance_url + API_STUB + ('/sobjects/%s/%s' % (table, pk))

        log.debug('DELETE %s(%s)' % (table, pk))
        ret = handle_api_exceptions(url, self.session.delete, _cursor=self)
        self.rowcount = 1 if (ret and ret.status_code == 204) else 0
        return ret
dataset/ETHPy150Open django-salesforce/django-salesforce/salesforce/backend/query.py/CursorWrapper.execute_delete