uranusjr commented on code in PR #76002:
URL: https://github.com/apache/airflow/pull/76002#discussion_r4421709291


##########
airflow-core/src/airflow/models/asset.py:
##########
@@ -811,6 +812,44 @@ def __repr__(self):
 )
 
 
+def consumed_by_dag(
+    dag_id: str | SQLColumnExpression[str], event_id: SQLColumnExpression[int]
+) -> ColumnElement[bool]:
+    """Check whether the asset event *event_id* has been consumed by a run of 
the Dag *dag_id*."""
+    from airflow.models.dagrun import DagRun
+
+    return (
+        select(association_table.c.event_id)
+        .join(DagRun, DagRun.id == association_table.c.dag_run_id)
+        .where(DagRun.dag_id == dag_id, association_table.c.event_id == 
event_id)
+        .exists()
+    )
+
+
+def insert_asset_dag_run_queue_rows(values: Sequence[dict[str, Any]], *, 
session: Session) -> None:
+    """Insert ADRQ rows, ignoring rows that are already queued."""
+    if (dialect_name := get_dialect_name(session)) == "mysql":
+        from sqlalchemy.dialects.mysql import insert as my_insert

Review Comment:
   I changed to `mysql_insert` instead (consistent in the other direction). We 
always import with an alias elsewhere for dialect-specific functions; `insert` 
is only used for the generic version (`from sqlalchemy import insert`).



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