amoghrajesh commented on code in PR #67902:
URL: https://github.com/apache/airflow/pull/67902#discussion_r3354971519


##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/asset_store.py:
##########
@@ -153,10 +194,27 @@ def set_asset_store_by_uri(
     key: Annotated[str, Query(min_length=1)],
     body: AssetStorePutBody,
     session: SessionDep,
+    token: TIToken = CurrentTIToken,
 ) -> None:
     """Set an asset store value by asset URI."""
     asset_id = _resolve_asset_id_by_uri(uri, session)
-    get_state_backend().set(AssetScope(asset_id=asset_id), key, 
json.dumps(body.value), session=session)
+    backend = get_state_backend()
+    scope = AssetScope(asset_id=asset_id)
+    if isinstance(backend, MetastoreStoreBackend):
+        dag_id, run_id, task_id, map_index = _fetch_ti_writer_fields(token, 
session)
+        backend.set_asset_store(
+            scope,
+            key,
+            json.dumps(body.value),
+            kind=AssetStoreWriterKind.TASK,
+            dag_id=dag_id,
+            run_id=run_id,
+            task_id=task_id,
+            map_index=map_index,
+            session=session,
+        )
+    else:
+        backend.set(scope, key, json.dumps(body.value), session=session)

Review Comment:
   Makes sense, extracted as helper



-- 
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]

Reply via email to