[GitHub] [airflow] uranusjr commented on a diff in pull request #28635: Defer to hook setting for split_statements in SQLExecuteQueryOperator

2022-12-29 Thread GitBox


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


##
airflow/providers/common/sql/operators/sql.py:
##
@@ -252,13 +253,16 @@ def _process_output(self, results: list[Any], 
descriptions: list[Sequence[Sequen
 def execute(self, context):
 self.log.info("Executing: %s", self.sql)
 hook = self.get_db_hook()
+extra_kwargs = {}
+if self.split_statements is not None:
+extra_kwargs.update(split_statements=self.split_statements)

Review Comment:
   ```suggestion
   if self.split_statements is not None:
   extra_kwargs = {"split_statements": self.split_statements}
   else:
   extra_kwargs = {}
   ```



##
airflow/providers/common/sql/operators/sql.pyi:
##
@@ -75,7 +75,7 @@ class SQLExecuteQueryOperator(BaseSQLOperator):
 autocommit: bool = ...,
 parameters: Union[Mapping, Iterable, None] = ...,
 handler: Callable[[Any], Any] = ...,
-split_statements: bool = ...,
+split_statements: Union[bool, None] = ...,

Review Comment:
   ```suggestion
   split_statements: Optional[bool] = ...,
   ```



##
airflow/providers/common/sql/operators/sql.py:
##
@@ -198,7 +198,8 @@ class SQLExecuteQueryOperator(BaseSQLOperator):
 :param autocommit: (optional) if True, each command is automatically 
committed (default: False).
 :param parameters: (optional) the parameters to render the SQL query with.
 :param handler: (optional) the function that will be applied to the cursor 
(default: fetch_all_handler).
-:param split_statements: (optional) if split single SQL string into 
statements (default: False).
+:param split_statements: (optional) if split single SQL string into 
statements. By default, defers
+to the default value in the ``run`` method in the configured hook.

Review Comment:
   ```suggestion
   to the default value in the ``run`` method of the configured hook.
   ```



-- 
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-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [airflow] uranusjr commented on a diff in pull request #28635: Defer to hook setting for split_statements in SQLExecuteQueryOperator

2022-12-28 Thread GitBox


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


##
airflow/providers/common/sql/operators/sql.py:
##
@@ -198,7 +198,7 @@ class SQLExecuteQueryOperator(BaseSQLOperator):
 :param autocommit: (optional) if True, each command is automatically 
committed (default: False).
 :param parameters: (optional) the parameters to render the SQL query with.
 :param handler: (optional) the function that will be applied to the cursor 
(default: fetch_all_handler).
-:param split_statements: (optional) if split single SQL string into 
statements (default: False).
+:param split_statements: (optional) if split single SQL string into 
statements (default: see hook.run).

Review Comment:
   What does *see hook.run* mean? Perhaps we should explain a bit more here.



-- 
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-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org