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


##########
airflow/api_fastapi/core_api/routes/public/assets.py:
##########
@@ -252,3 +252,36 @@ def get_dag_asset_queued_events(
         ],
         total_entries=total_entries,
     )
+
+
+@assets_router.get(
+    "/dags/{dag_id}/assets/queuedEvent/{uri:path}",
+    responses=create_openapi_http_exception_doc(
+        [
+            status.HTTP_404_NOT_FOUND,
+        ]
+    ),
+)
+def get_dag_asset_queued_event(
+    dag_id: str,
+    uri: str,
+    session: Annotated[Session, Depends(get_session)],
+    before: OptionalDateTimeQuery = None,
+) -> QueuedEventResponse:
+    """Get a queued asset event for a DAG."""
+    where_clause = _generate_queued_event_where_clause(dag_id=dag_id, uri=uri, 
before=before)
+    query = (
+        select(AssetDagRunQueue)
+        .join(AssetModel, AssetDagRunQueue.asset_id == AssetModel.id)
+        .where(*where_clause)
+    )
+    adrq = session.scalar(query)
+    if not adrq:
+        raise HTTPException(
+            status.HTTP_404_NOT_FOUND,
+            f"Queued event with dag_id: `{dag_id}` and asset uri: `{uri}` was 
not found",
+        )
+
+    queued_event = QueuedEventResponse(created_at=adrq.created_at, 
dag_id=adrq.target_dag_id, uri=uri)
+
+    return QueuedEventResponse.model_validate(queued_event, 
from_attributes=True)

Review Comment:
   Oh yes, this is good



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