code: def run_sql_query(self, sql, required=False, query_params=[]):
          
          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
docs: 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.