title: how to get latest execution time of a dag run in airflow
body: <p>I tried below code but still i am getting issue</p>
  <pre><code>from airflow.models DagModel
  
  def get_latest_execution_date(**kwargs):
  
  session = airflow.settings.Session()
  
  f = open(&quot;/home/Insurance/InsuranceDagsTimestamp.txt&quot;,&quot;w+&quot;)
  
  try:
      Insurance_last_dag_run = session.query(DagModel)
      for Insdgrun in Insurance_last_dag_run:
          if Insdgrun is None: 
              f.write(Insdgrun.dag_id+&quot;,9999-12-31&quot;+&quot;\n&quot;)
          else:
              f.write(Insdgrun.dag_id+&quot;,&quot;+ Insdgrun.execution_date+&quot;\n&quot;)
  except:
      session.rollback()
  finally:
      session.close()
  
  t1 = PythonOperator(
      task_id='records',
      provide_context=True,
      python_callable=get_latest_execution_date,
      dag=dag)
  </code></pre>
  <p>Is there any way how to fix and get the latest dag run time information</p>