def get_users(self, search=None):
        """
        To return list of entities that have
        'entu-user' or 'entu-api-key' property.
        """

        query_re = ''
        if search != None:
            join_parts = []
            for s in search.split(' ')[:5]:
                if not s:
                    continue
                join_parts.append({'qs': s} % 'AND sp.value_display REGEXP(\'%(qs)s\')')
            query_re = ' '.join(join_parts)

        sql = """
            SELECT DISTINCT e.id AS id, sp.value_display, spd.*
            FROM entity AS e
            LEFT JOIN relationship AS r           ON r.entity_id  = e.id
            LEFT JOIN property AS p               ON p.entity_id = e.id
            RIGHT JOIN property_definition AS pd  ON p.property_definition_keyname = pd.keyname
                                                 AND pd.dataproperty IN ('entu-user','entu-api-key')
            LEFT JOIN property AS sp              ON sp.entity_id = e.id
            %(query_re)s
            LEFT JOIN property_definition AS spd ON spd.keyname = sp.property_definition_keyname
                                                 AND spd.is_deleted = 0
                                                 AND spd.search = 1
            WHERE e.is_deleted = 0
            AND r.is_deleted = 0
            AND p.is_deleted = 0
            AND sp.is_deleted = 0
            AND ( r.related_entity_id = %(user_id)i AND r.relationship_definition_keyname IN ('viewer', 'expander', 'editor', 'owner')
               OR e.sharing IN ('domain', 'public')
            ) ORDER BY e.sort, e.created DESC;
        """ % {'user_id': self.__user_id, 'query_re': query_re}
        # logging.debug(sql)
        ids = self.db_query(sql)
        # logging.debug(ids)

        entities = self.__get_properties(entity_id=[x.get('id') for x in ids])
        if not entities:
            return []

        return entities
dataset/ETHPy150Open argoroots/Entu/app/main/db.py/Entity.get_users/swapped operands of `%`