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


##########
providers/common/sql/src/airflow/providers/common/sql/triggers/sql.py:
##########
@@ -17,37 +17,64 @@
 # under the License.
 from __future__ import annotations
 
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, cast
 
-from airflow.providers.common.compat.sdk import AirflowException, BaseHook
+from asgiref.sync import sync_to_async
+
+from airflow.providers.common.compat.hook import get_async_hook
 from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_2_PLUS
+from airflow.providers.common.sql.hooks.handlers import fetch_all_handler
 from airflow.providers.common.sql.hooks.sql import DbApiHook
 from airflow.triggers.base import BaseTrigger, TriggerEvent
 
 if TYPE_CHECKING:
-    from collections.abc import AsyncIterator
+    from collections.abc import AsyncIterator, Callable
     from typing import Any
 
+from collections.abc import (
+    Iterable,
+    Mapping,
+    Sequence,
+)
+
 
 class SQLExecuteQueryTrigger(BaseTrigger):
     """
-    A trigger that executes SQL code in async mode.
+    A SQL trigger that executes SQL code in async mode.
+
+    The query runs in the triggerer, but no user code does: when 
``fetch_results`` is set the rows are
+    fetched with the built-in :func:`fetch_all_handler` and returned, together 
with the cursor
+    descriptions, in the ``TriggerEvent``. Any user-provided ``handler`` is 
applied on the worker in
+    ``SQLExecuteQueryOperator.execute_complete`` -- keeping user code out of 
the triggerer's event loop
+    and out of its (bundle-less) import path.
 
     :param sql: the sql statement to be executed (str) or a list of sql 
statements to execute
     :param conn_id: the connection ID used to connect to the database
+    :param fetch_results: whether the query results should be fetched and 
returned to the worker
     :param hook_params: hook parameters
     """
 
     def __init__(
         self,
-        sql: str | list[str],
+        sql: str | Iterable[str],
         conn_id: str,
+        autocommit: bool,
+        split_statements: bool,
+        return_last: bool,

Review Comment:
   Are these supposed to be required? This would break compatibility, and also 
I think they should have sensible defaults.



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