ephraimbuddy commented on a change in pull request #15174:
URL: https://github.com/apache/airflow/pull/15174#discussion_r606672209
##########
File path: airflow/api_connexion/endpoints/dag_run_endpoint.py
##########
@@ -240,6 +240,18 @@ def post_dag_run(dag_id, session):
post_body = dagrun_schema.load(request.json, session=session)
except ValidationError as err:
raise BadRequest(detail=str(err))
+
+ dagrun_with_execution_date = (
+ session.query(DagRun).filter(DagRun.dag_id == dag_id,
+ DagRun.execution_date ==
post_body["execution_date"]).first()
+ )
+
+ if dagrun_with_execution_date:
+ raise AlreadyExists(
+ detail=f"DAGRun with DAG ID: '{dag_id}' and DAGRun ExecutionDate:
'{post_body['execution_date']}' already "
+ f"exists"
+ )
+
Review comment:
Can you add execution_date to the filter in line 256 instead of another
query?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]