def METHOD_NAME(cls, sql, fields=None, params=None, count=False):
    """
    Returns an iterator of all records.
    """
    # cursor seems to stringify dicts
    # added workaround to parse stringified dicts to json
    def parse_json(data):
        """Helper function to return a JSON string ``data`` as a python object."""
        try:
            return json.loads(data)
        except ValueError:
            return data
    params = params if params is not None else []
    cursor = connection.cursor()
    sql_params = fields + params if fields is not None else params
    if count:
        from_pos = sql.upper().find(" FROM")
        if from_pos != -1:
            sql = "SELECT COUNT(*) " + sql[from_pos:]
        order_pos = sql.upper().find("ORDER BY")
        if order_pos != -1:
            sql = sql[:order_pos]
        sql_params = params
        fields = ["count"]
    cursor.execute(sql, sql_params)
    if fields is None:
        for row in cursor.fetchall():
            yield parse_json(row[0])
    else:
        for row in cursor.fetchall():
            yield dict(zip(fields, row))