This is an automated email from the ASF dual-hosted git repository.
shahar pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-0-test by this push:
new 48790d63840 [v3-0-test] Docs `assets.rst`: use `AssetAlias` for alias
in `Metadata` example (#50768) (#51000)
48790d63840 is described below
commit 48790d63840db46b2d21f4a21d4cd3c80c976304
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat May 24 20:06:58 2025 +0300
[v3-0-test] Docs `assets.rst`: use `AssetAlias` for alias in `Metadata`
example (#50768) (#51000)
This PR fixes an inconsistency in the `assets.rst` documentation example.
The sample code used a plain string for the `alias` argument in
`Metadata()`, which in reality raises:
> TypeError: Key should be either an asset or an asset alias, not <class
'str'>
This change updates the example to use a typed
`AssetAlias("my-task-outputs")`, matching the SDK API and avoiding that error.
(cherry picked from commit ed671144ca88176e57adc53c64c2226078577452)
Co-authored-by: QBidolet <[email protected]>
---
airflow-core/docs/authoring-and-scheduling/assets.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/airflow-core/docs/authoring-and-scheduling/assets.rst
b/airflow-core/docs/authoring-and-scheduling/assets.rst
index dbbecd91ef8..4664c51d7f0 100644
--- a/airflow-core/docs/authoring-and-scheduling/assets.rst
+++ b/airflow-core/docs/authoring-and-scheduling/assets.rst
@@ -298,7 +298,7 @@ The following example creates an asset event against the S3
URI ``f"s3://bucket/
@task(outlets=[AssetAlias("my-task-outputs")])
def my_task_with_metadata():
s3_asset = Asset(uri="s3://bucket/my-task", name="example_s3")
- yield Metadata(s3_asset, extra={"k": "v"}, alias="my-task-outputs")
+ yield Metadata(s3_asset, extra={"k": "v"},
alias=AssetAlias("my-task-outputs"))
Only one asset event is emitted for an added asset, even if it is added to the
alias multiple times, or added to multiple aliases. However, if different
``extra`` values are passed, it can emit multiple asset events. In the
following example, two asset events will be emitted.