@classmethod<EOL><INDENT>def _extract_where(cls, queryset):<DEDENT>
if not cls._is_simple_query(queryset.query):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>sql, params = queryset.query.sql_with_params()<EOL>where_pos = sql.find('<STR_LIT>')<EOL>if where_pos != -<NUM_LIT:1>:<EOL><INDENT>where_clause = sql[where_pos:]<EOL>where_clause, _ = cls.absolute_col_re.subn(r"<STR_LIT>", where_clause)<EOL>return (where_clause, params)<EOL><DEDENT>else:<EOL><INDENT>return ("<STR_LIT>", ())<EOL><DEDENT>
Was this a queryset with filters/excludes/expressions set? If so,
extract the WHERE clause from the ORM output so we can use it in the
handler queries.