ashb commented on a change in pull request #4584: [AIRFLOW-3741] Add extra 
config to Oracle hook
URL: https://github.com/apache/airflow/pull/4584#discussion_r251025721
 
 

 ##########
 File path: airflow/hooks/oracle_hook.py
 ##########
 @@ -128,13 +181,33 @@ def bulk_insert_rows(self, table, rows, 
target_fields=None, commit_every=5000):
         A performant bulk insert for cx_Oracle
         that uses prepared statements via `executemany()`.
         For best performance, pass in `rows` as an iterator.
+
+        :param table: target Oracle table, use dot notation to target a
+            specific database
+        :type table: str
+        :param rows: the rows to insert into the table
+        :type rows: iterable of tuples
+        :param target_fields: the names of the columns to fill in the table, 
default None.
+            If None, each rows should have some order as table columns name
+        :type target_fields: iterable of str Or None
+        :param commit_every: the maximum number of rows to insert in one 
transaction
+            Default 5000. Set greater than 0. Set 1 to insert each row in each 
transaction
+        :type commit_every: int
         """
+        if not rows:
+            raise ValueError("rows could not be null or None.")
         conn = self.get_conn()
         cursor = conn.cursor()
-        values = ', '.join(':%s' % i for i in range(1, len(target_fields) + 1))
-        prepared_stm = 'insert into {tablename} ({columns}) values 
({values})'.format(
+        if target_fields:
 
 Review comment:
   Your PR is "Add extra config to Oracle hook" - that sounds like a different 
issue. Please could you open that as a separate PR?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to