atul-astronomer commented on issue #47779:
URL: https://github.com/apache/airflow/issues/47779#issuecomment-2747206952
@Lee-W I am getting same error for which this issue was reported in couple
of other Dag also, can you please check?
```python
from __future__ import annotations
import pendulum
from airflow.sdk import DAG
from airflow.datasets import Dataset, DatasetAlias
from airflow.decorators import task
from airflow.sdk import Asset
with DAG(
dag_id="dataset_alias_example_alias_producer",
start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
schedule=None,
catchup=False,
tags=["dataset"],
):
@task(outlets=[DatasetAlias("example-alias")])
def produce_dataset_events_through_dataset_alias(*, outlet_events=None):
bucket_name = "bucket"
object_path = "my-task"
outlet_events["example-alias"].add(Asset(f"s3://{bucket_name}/{object_path}"))
produce_dataset_events_through_dataset_alias()
```
ERROR - Task failed with exception source="task"
error_detail=[{"exc_type":"TypeError","exc_value":"Key should be either an
asset or an asset alias, not <class
'str'>","exc_notes":[],"syntax_error":null,"is_cause":false,"frames":[{"filename":"/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":614,"name":"run"},{"filename":"/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":839,"name":"_execute_task"},{"filename":"/opt/airflow/task-sdk/src/airflow/sdk/definitions/baseoperator.py","lineno":377,"name":"wrapper"},{"filename":"/opt/airflow/airflow-core/src/airflow/decorators/base.py","lineno":252,"name":"execute"},{"filename":"/opt/airflow/task-sdk/src/airflow/sdk/definitions/baseoperator.py","lineno":377,"name":"wrapper"},{"filename":"/opt/airflow/providers/standard/src/airflow/providers/standard/operators/python.py","lineno":202,"name":"execute"},{"filename":"/opt/airflow/providers/standard/src/airflow/providers/standard/operators
/python.py","lineno":226,"name":"execute_callable"},{"filename":"/opt/airflow/airflow-core/src/airflow/utils/operator_helpers.py","lineno":161,"name":"run"},{"filename":"/files/dags/datasets/2.10dags/example_dataset_alias.py","lineno":55,"name":"produce_dataset_events_through_dataset_alias"},{"filename":"/opt/airflow/task-sdk/src/airflow/sdk/execution_time/context.py","lineno":319,"name":"__getitem__"}]}]
<img width="583" alt="Image"
src="https://github.com/user-attachments/assets/5cf01e25-1029-4317-ae2d-ffbc32d8b8bb"
/>
--
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]