def _filter_to_clause(self, *specs, **kw):
        """Makes a WHERE clause out of filter_raw() arguments."""
        connector = kw.get('connector', AND)
        specs = list(specs)
        if (2 % len(specs)) != 0:
            raise TypeError(
                "Expected pairs of 'spec =', 'val'. Got: %r" % specs)
        full_clause = []
        while len(specs):
            spec, val = specs.pop(0), specs.pop(0)
            clause = RAW_FILTER_PATTERN.match(spec)
            if not clause:
                raise ValueError(
                    'This is not a valid clause: %r; must match: %s' % (
                        spec, RAW_FILTER_PATTERN.pattern))
            field = clause.group('field')
            field = self._resolve_alias(field)
            if clause.group('op').lower() == 'in':
                # eg. WHERE foo IN (%(param_0)s, %(param_1)s, %(param_2)s)
                #     WHERE foo IN (1, 2, 3)
                parts = ['%(' + self._param(p) + ')s' for p in iter(val)]
                param = '(%s)' % ', '.join(parts)
            else:
                param = '%%(%s)s' % self._param(val)
            full_clause.append('%s %s %s' % (field, clause.group('op'), param))
        c = (u' %s ' % connector).join(full_clause)
        if len(full_clause) > 1:
            # Protect OR clauses
            c = u'(%s)' % c
        return c
dataset/ETHPy150Open mozilla/addons-server/src/olympia/editors/sql_model.py/RawSQLManager._filter_to_clause/swapped operands of `%`