def _is_query_precomputed(query):
 rules = list(query._rules)
 while rules:
  rule = rules.pop()
  if isinstance(rule, BooleanOp):
   rules.extend(rule.ops)
   continue
  if (rule.lval.name == '_date'):
   return True
 return False

def _is_query_precomputed ( query ) : rules = list ( query . _rules ) while rules : rule = rules . pop ( ) if isinstance ( rule , BooleanOp ) : rules . extend ( rule . ops ) continue if ( rule . lval . name == '_date' ) : return True return False
return if this query must be updated offline in a batch job .