If I had an external method that reads a CSV file from the filesystem using the python CSV module what would be the best way of passing the rows returned into a ZSQL method to write into a RDBMS? regards garry
The easiest would be if you initialise the csv.reader with field names, because then each row will be a dictionary that can be passed as keyword arguments to a ZSQL method. In this case, the ZSQL method must have argument names matching the csv file's fieldnames: for row in csv_reader: YourZSQLMethod(**row) If the csv file don't have fieldnames then you must do the keyword assignment yourself: for row in csv_reader: field1, field2, field3 = row YourZSQLMethod(arg1=field1, arg2=field2, arg3=field3) -- Roché Compaan Upfront Systems http://www.upfrontsystems.co.za * garry saddington <garry@joydiv.fsnet.co.uk> [2004-08-05 21:33]:
If I had an external method that reads a CSV file from the filesystem using the python CSV module what would be the best way of passing the rows returned into a ZSQL method to write into a RDBMS? regards garry
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
garry saddington -
Roché Compaan