<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run_sql_query(self, sql, required=False, query_params=[]):
 """ Given an arbitrary SQL query, run it against the database and return the results. Parameters sql : str SQL query required : bool Raise an error if no results found in the database query_params : list For each '?' in the query there must be a corresponding value in this list. """

        try:
            cursor = self.connection.execute(sql, query_params)
        except sqlite3.OperationalError as e:
            error_message = e.message if hasattr(e, 'message') else str(e)
            logger.warn(
                "Encountered error \"%s\" from query \"%s\" with parameters %s",
                error_message,
                sql,
                query_params)
            raise
        results = cursor.fetchall()
        if required and not results:
            raise ValueError(
                "No results found for query:\n%s\nwith parameters: %s" % (
                    sql, query_params))

        return results