ephraimbuddy commented on code in PR #37570:
URL: https://github.com/apache/airflow/pull/37570#discussion_r1499201237


##########
airflow/api_connexion/endpoints/dataset_endpoint.py:
##########
@@ -311,3 +323,37 @@ def delete_dataset_queued_events(
         "Queue event not found",
         detail=f"Queue event with dataset uri: `{uri}` was not found",
     )
+
+
+@security.requires_access_dataset("POST")
+@provide_session
+@action_logging(
+    event=action_event_from_permission(
+        prefix=RESOURCE_EVENT_PREFIX,
+        permission=permissions.ACTION_CAN_CREATE,
+    ),
+)
+def post_dataset_event(session: Session = NEW_SESSION) -> APIResponse:
+    """Post dataset event."""
+    body = get_json_request_dict()
+    try:
+        json_body = create_dataset_event_schema.load(body)
+    except ValidationError as err:
+        raise BadRequest(detail=str(err))
+
+    uri = json_body["dataset_uri"]
+    dataset = session.scalar(select(DatasetModel).where(DatasetModel.uri == 
uri).limit(1))
+    if not dataset:
+        raise NotFound(title="Dataset not found", detail=f"Dataset with uri: 
'{uri}' not found")
+    timestamp = datetime.now(timezone.utc)

Review Comment:
   Should we use airflow.utils.timezone.utcnow for this? See 
https://github.com/apache/airflow/pull/35448



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to