To be correct in getting actual data who manualy triggered your dag:
with create_session() as session:
results = session.query(Log).filter(
Log.dag_id == "your_dag_id",
Log.event == "trigger",
Log.execution_date == "here should be execution date of dagrun"
).first()
print(results.owner)
If you want to use this code inside some PythonOperator function with context input, then solution will be:
with create_session() as session:
results = session.query(Log).filter(
Log.dag_id == context["dag_run"].dag_id,
Log.event == "trigger",
Log.execution_date == context["dag_run"].execution_date
).first()
if results:
print(f'User who manualy started dagRun: {results.owner}')
else:
print('No data from log')
When results will be None?
p.s. now i am looking for how to fetch info about who and from what dag_id has triggered my dag.