You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dstandish (via GitHub)" <gi...@apache.org> on 2023/05/18 04:15:45 UTC
[GitHub] [airflow] dstandish commented on a diff in pull request #29433: Add dataset update endpoint
dstandish commented on code in PR #29433:
URL: https://github.com/apache/airflow/pull/29433#discussion_r1197341106
##########
airflow/api_connexion/endpoints/dataset_endpoint.py:
##########
@@ -120,3 +130,40 @@ def get_dataset_events(
return dataset_event_collection_schema.dump(
DatasetEventCollection(dataset_events=events, total_entries=total_entries)
)
+
+
+@security.requires_access([(permissions.ACTION_CAN_CREATE, permissions.RESOURCE_DATASET)])
+@provide_session
+def post_dataset_event(session: Session = NEW_SESSION) -> APIResponse:
+ """Create an external dataset event. This endpoint is useful if you want to update a dataset and
+ trigger downstream DAG runs from external services.
+ """
+ try:
+ json_body = dataset_change_schema.load(get_json_request_dict())
+ except ValidationError as err:
+ raise BadRequest(detail=str(err))
+ uri = json_body["dataset_uri"]
+ external_source = request.remote_addr
+ user_id = getattr(current_user, "id", None)
Review Comment:
isn't the id how a typical FK->PK relationship is defined?
it seems appropriate to add user_id and make a FK to users table. then one could always look up the username by joining?
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org