kazanzhy commented on code in PR #23971:
URL: https://github.com/apache/airflow/pull/23971#discussion_r885548500


##########
airflow/hooks/dbapi.py:
##########
@@ -188,25 +206,21 @@ def run(self, sql, autocommit=False, parameters=None, 
handler=None):
                 self.set_autocommit(conn, autocommit)
 
             with closing(conn.cursor()) as cur:
-                results = []
                 for sql_statement in sql:
+                    results = []
                     self._run_command(cur, sql_statement, parameters)
                     if handler is not None:
                         result = handler(cur)
                         results.append(result)

Review Comment:
   I think that list is a good container and personally, for me, solution 1-ii 
seems the best one.
   Let's say that we have the following list:
   `sql=["INSERT ...;", "SELECT 1; SELECT 2;", "DELETE ...;", "SELECT 3:"]`
   
   I think that returning should be:
   `[None, [(2,)], None,[(3,)],]`
   
   Also, the s 1-i is easy to implement if we will try to split every statement 
in the list.
   But in this case, lengths of input and output lists might be different, 
which is not right thing for me
   



##########
airflow/hooks/dbapi.py:
##########
@@ -188,25 +206,21 @@ def run(self, sql, autocommit=False, parameters=None, 
handler=None):
                 self.set_autocommit(conn, autocommit)
 
             with closing(conn.cursor()) as cur:
-                results = []
                 for sql_statement in sql:
+                    results = []
                     self._run_command(cur, sql_statement, parameters)
                     if handler is not None:
                         result = handler(cur)
                         results.append(result)

Review Comment:
   I think that list is a good container and personally, for me, solution 1-ii 
seems the best one.
   Let's say that we have the following list:
   `sql=["INSERT ...;", "SELECT 1; SELECT 2;", "DELETE ...;", "SELECT 3:"]`
   
   I think that returning should be:
   `[None, [(2,)], None,[(3,)],]`
   
   Also, the s 1-i is easy to implement if we will try to split every statement 
in the list.
   But in this case, lengths of input and output lists might be different, 
which is not the right thing for me
   



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