def insert_rows(self, table, rows, target_fields=None, commit_every=<NUM_LIT:1000>):
if target_fields:<EOL><INDENT>target_fields = '<STR_LIT:U+002CU+0020>'.join(target_fields)<EOL>target_fields = '<STR_LIT>'.format(target_fields)<EOL><DEDENT>else:<EOL><INDENT>target_fields = '<STR_LIT>'<EOL><DEDENT>conn = self.get_conn()<EOL>cur = conn.cursor()<EOL>if self.supports_autocommit:<EOL><INDENT>cur.execute('<STR_LIT>')<EOL><DEDENT>conn.commit()<EOL>i = <NUM_LIT:0><EOL>for row in rows:<EOL><INDENT>i += <NUM_LIT:1><EOL>lst = []<EOL>for cell in row:<EOL><INDENT>if isinstance(cell, basestring):<EOL><INDENT>lst.append("<STR_LIT:'>" + str(cell).replace("<STR_LIT:'>", "<STR_LIT>") + "<STR_LIT:'>")<EOL><DEDENT>elif cell is None:<EOL><INDENT>lst.append('<STR_LIT>')<EOL><DEDENT>elif type(cell) == float andnumpy.isnan(cell):  <EOL><INDENT>lst.append('<STR_LIT>')<EOL><DEDENT>elif isinstance(cell, numpy.datetime64):<EOL><INDENT>lst.append("<STR_LIT:'>" + str(cell) + "<STR_LIT:'>")<EOL><DEDENT>elif isinstance(cell, datetime):<EOL><INDENT>lst.append("<STR_LIT>" +<EOL>cell.strftime('<STR_LIT>') +<EOL>"<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>lst.append(str(cell))<EOL><DEDENT><DEDENT>values = tuple(lst)<EOL>sql = '<STR_LIT>''<STR_LIT>'.format(table,<EOL>target_fields,<EOL>'<STR_LIT:U+002C>'.join(values))<EOL>cur.execute(sql)<EOL>if i % commit_every == <NUM_LIT:0>:<EOL><INDENT>conn.commit()<EOL>self.log.info('<STR_LIT>', i, table)<EOL><DEDENT><DEDENT>conn.commit()<EOL>cur.close()<EOL>conn.close()<EOL>self.log.info('<STR_LIT>', i)<EOL>
A generic way to insert a set of tuples into a table,
the whole set of inserts is treated as one transaction
Changes from standard DbApiHook implementation:

- Oracle SQL queries in cx_Oracle can not be terminated with a semicolon (`;`)
- Replace NaN values with NULL using `numpy.nan_to_num` (not using
  `is_nan()` because of input types error for strings)
- Coerce datetime cells to Oracle DATETIME format during insert

: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
:type target_fields: iterable of str
:param commit_every: the maximum number of rows to insert in one transaction
    Default 1000, Set greater than 0.
    Set 1 to insert each row in each single transaction
:type commit_every: int