TJaniF opened a new issue, #48411:
URL: https://github.com/apache/airflow/issues/48411
### Apache Airflow version
3.0.0
### If "Other Airflow 2 version" selected, which one?
current main
### What happened?
When accessing the Airflow context in an `@asset` needs an additional
`["context"]` to be able to access values vs @task. According to @uranusjr this
is a bug, but even if not I think it would be good to have parity here for
users :)
```
from airflow.sdk import asset, dag
from airflow.decorators import task
@asset(schedule="@daily")
def access_context_asset(**context):
print(context["context"]["dag_run"].run_after)
@dag
def access_context_dag():
@task
def access_context_task(**context):
print(context["dag_run"].run_after)
access_context_task()
access_context_dag()
```
### What you think should happen instead?
`print(context["dag_run"].run_after)` should work in @asset as well
### How to reproduce
Run the above dag and asset, they produce the same output for different
print statements.
### Operating System
MacOS 15.3.2 (24D81)
### Versions of Apache Airflow Providers
_No response_
### Deployment
Other
### Deployment details
Breeze
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]