@@ -262,14 +262,10 @@ def executemany(self: "Cursor", operation, param_sets) -> "Cursor":
262262 self ._redshift_row_count = - 1 if - 1 in redshift_rowcounts else sum (rowcounts )
263263 return self
264264
265- def insert_data_bulk (
266- self : "Cursor" , filename , table_name , column_indexes , column_names , delimeter
267- ) -> "Cursor" :
265+ def insert_data_bulk (self : "Cursor" , filename , table_name , column_indexes , column_names , delimeter ) -> "Cursor" :
268266
269267 """runs a single bulk insert statement into the database.
270-
271268 This method is native to redshift_connector.
272-
273269 :param filename: str
274270 The name of the file to read from.
275271 :param table_name: str
@@ -280,21 +276,14 @@ def insert_data_bulk(
280276 The indexes of the columns in the table to insert to.
281277 :param delimeter: str
282278 The delimeter to use when reading the file.
283-
284279 Returns
285-
286280 -------
287281 The Cursor object used for executing the specified database operation: :class:`Cursor`
288-
289282 """
290283 if not self .__is_valid_table (table_name ):
291- raise InterfaceError (
292- "Invalid table name passed to insert_data_bulk: {}" .format (table_name )
293- )
284+ raise InterfaceError ("Invalid table name passed to insert_data_bulk: {}" .format (table_name ))
294285 if not self .__has_valid_columns (table_name , column_names ):
295- raise InterfaceError (
296- "Invalid column names passed to insert_data_bulk: {}" .format (table_name )
297- )
286+ raise InterfaceError ("Invalid column names passed to insert_data_bulk: {}" .format (table_name ))
298287 orig_paramstyle = self .paramstyle
299288 import csv
300289
@@ -325,16 +314,12 @@ def insert_data_bulk(
325314
326315 return self
327316
328- def __has_valid_columns (
329- self : "Cursor" , table : str , columns : typing .List [str ]
330- ) -> bool :
317+ def __has_valid_columns (self : "Cursor" , table : str , columns : typing .List [str ]) -> bool :
331318 split_table_name : typing .List [str ] = table .split ("." )
332319 q : str = "select 1 from information_schema.columns where table_name = ? and column_name = ?"
333320 if len (split_table_name ) == 2 :
334321 q += " and table_schema = ?"
335- param_list = [
336- [split_table_name [1 ], c , split_table_name [0 ]] for c in columns
337- ]
322+ param_list = [[split_table_name [1 ], c , split_table_name [0 ]] for c in columns ]
338323 else :
339324 param_list = [[split_table_name [0 ], c ] for c in columns ]
340325 temp = self .paramstyle
@@ -344,11 +329,7 @@ def __has_valid_columns(
344329 self .execute (q , params )
345330 res = self .fetchone ()
346331 if typing .cast (typing .List [int ], res )[0 ] != 1 :
347- raise InterfaceError (
348- "Invalid column name: {} specified for table: {}" .format (
349- params [1 ], table
350- )
351- )
332+ raise InterfaceError ("Invalid column name: {} specified for table: {}" .format (params [1 ], table ))
352333 except :
353334 raise
354335 finally :
0 commit comments