File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,8 @@ def add_arguments(self):
3434 help = 'A comma separated list of column indices or names to skip type inference. Specified columns will be treated as strings.' )
3535
3636 def main (self ):
37- # Ensure we're handling a list, even if it's just one file
38- if not isinstance (self .args .files , list ):
39- self .args .files = [self .args .files ]
40- else :
41- if self .args .table_name :
42- self .argparser .error ('The --table argument is only allowed when specifying a single file.' )
37+ if len (self .args .files ) > 1 and self .args .table_name :
38+ self .argparser .error ('The --table argument is only allowed when specifying a single file.' )
4339
4440 for f in self .args .files :
4541 if self .args .table_name :
@@ -81,8 +77,7 @@ def main(self):
8177
8278 conn = engine .connect ()
8379 trans = conn .begin ()
84- for row in csv_table .to_rows ():
85- conn .execute (insert , [dict (zip (headers , row )), ])
80+ conn .execute (insert , [dict (zip (headers , row )) for row in csv_table .to_rows ()])
8681 trans .commit ()
8782 conn .close ()
8883
You can’t perform that action at this time.
0 commit comments