GitHub user potiuk added a comment to the discussion: DAG callback `context` does not have `dag_run` set in Airflow 3 but it is set in Airflow 2.
Yes. That's deliberate change described in the changelog - one of the hallmark features of Airflow 3 where we isolated DB access from worker. Previously you could do more things with `dag` because it was an ORM object representing database DAG table. Now it is just an "object" that is passed through HTTP Task SDK. You should look at the changelog and see the recommendation and explanations in documentation. Including the advise to use Airflow's REST API to access the information about Dags, DagRuns and other airflow properties. This has been recommended for about 4 years now and the DB access was marked as not part of the publlc API since generally the beginning of Airflow 2 - Airflow 3 now enforces it and does not allow direct database access. If you feel like some things (from the logical point of view) should be available via task-sdk and you would think that accessing it in your worker without having to use public REST API, I recommend you to open an issue explainig the use pattern you want to have, why you think it is a common pattern that others will want to use, and possibly look at task SDK and propose where and how it could be implemented. We are doing it already when some of the "often used" access methods were commonly used and are missing now - for example https://github.com/apache/airflow/issues/53628 - and we might consider adding it (but it's not like to follow previous access pattern where you could directly access "Database ORM objects) - you need to explain what exactly you need to access (specific logic you want to use it for) and explain why current REST API is not enough (basically what makes you think that the useage is common enough and "task" bound - so that you think it shoudl be built-in). GitHub link: https://github.com/apache/airflow/discussions/53618#discussioncomment-13863386 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
