uranusjr commented on code in PR #31772:
URL: https://github.com/apache/airflow/pull/31772#discussion_r1222560471
##########
airflow/api_connexion/endpoints/xcom_endpoint.py:
##########
@@ -93,15 +93,20 @@ def get_xcom_entry(
) -> APIResponse:
"""Get an XCom entry."""
if deserialize:
- query = session.query(XCom, XCom.value)
+ query = select(XCom, XCom.value)
else:
- query = session.query(XCom)
+ query = select(XCom)
- query = query.filter(XCom.dag_id == dag_id, XCom.task_id == task_id,
XCom.key == xcom_key)
+ query = query.where(XCom.dag_id == dag_id, XCom.task_id == task_id,
XCom.key == xcom_key)
query = query.join(DR, and_(XCom.dag_id == DR.dag_id, XCom.run_id ==
DR.run_id))
- query = query.filter(DR.run_id == dag_run_id)
+ query = query.where(DR.run_id == dag_run_id)
+
+ # TODO: Unify the query. Can't figure it out right now.
+ if deserialize:
+ item = session.execute(query).one_or_none()
+ else:
+ item = session.scalars(query).one_or_none()
Review Comment:
I think this fine actually.
--
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]