code: def get_history(self, project_name=None):
      query = (
          db.session.query(db.JobsHistory, db.Jobs)
          .filter_by(
              company_id=ctx.company_id,
          )
          .outerjoin(db.Jobs, db.Jobs.id == db.JobsHistory.job_id)
      )
  
      project_controller = ProjectController()
      if project_name is not None:
          project = project_controller.get(name=project_name)
          query = query.filter_by(project_id=project.id)
  
      data = []
      project_names = {
          i.id: i.name for i in project_controller.get_list()
      }
      for record in query:
          data.append(
              {
                  "name": record.Jobs.name,
                  "project": project_names[record.Jobs.project_id],
                  "run_start": record.JobsHistory.start_at,
                  "run_end": record.JobsHistory.end_at,
                  "error": record.JobsHistory.error,
                  "query": record.JobsHistory.query_str,
              }
          )
      return data
  
imports: import re
  import datetime
  from dateutil.relativedelta import relativedelta
  import sqlalchemy
  from mindsdb_sql import parse_sql, ParsingException
  from mindsdb.utilities.context import context
  from mindsdb.utilities.exception import EntityNotExistsError, EntityExistsError
  from mindsdb.interfaces.storage import db
  from mindsdb.interfaces.database.projects import ProjectController
  from mindsdb.interfaces.query_context.context_controller import query_context_controller
  from mindsdb.utilities import log
label_desc: Use image node_id 6 for calling the JobsController obj's underlying member method code with example usage: obj.get_history(project_name) and returns: data