Good news guys, this code is working for me:
import MySQLdb
import csv
def imports():
db = MySQLdb.connect(user='...', db='...', passwd='...', host='...')
cursor = db.cursor()
file = "C:\\test_import.txt"
for i, line in enumerate(open(file)):
if i == 0:
continue
data_first, data_last, data_phone, data_email =
line.rstrip('\n').split('\t')
statement = "Inserting " + data_first + ", " + data_last + ", " +
data_phone + ", " + data_email
print statement
cursor.execute("""
INSERT INTO people
(first, last, phone, email)
VALUES
(%s, %s, %s, %s)
""", (data_first, data_last, data_phone, data_email)
)
return "Job Finished"
This method seems faster than having to deal with Django models. And
to think, I was about to buy Navicat :P.
Thank you so much for all your help!
-robo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---