Describe csvtosql here. Csv to Sql in python

import time
import csv
import csvtosql
import MySQLdb

db=MySQLdb.connect(host="localhost",user="yourusername",passwd="yourpass",db="yourdbname")
dbconnection=db
tablename='GLAZING'
filename='GLAZING.csv'
f=csv.DictReader(open(filename))
for row in f:
    #if not row['DATE']=='':
    #    row['DATE']=time.strftime("%Y%m%d",time.strptime(row['DATE'],"%m/%d/%y %H:%M:%S"))
    csvtosql.savetosql(dbconnection,row,tablename)

MyWiki: csvtosql (last edited 2009-09-06 02:49:58 by localhost)