Reputation: 25597
I'm using Python in order to save the data row by row... but this is extremely slow!
The CSV contains 70million lines, and with my script I can just store 1thousand a second.
This is what my script looks like
reader = csv.reader(open('test_results.csv', 'r'))
for row in reader:
TestResult(type=row[0], name=row[1], result=row[2]).save()
I reckon that for testing I might have to consider MySQL or PostgreSQL.
Any idea or tips? This is the first time I deal with such massive volumes of data. :)
Upvotes: 8
Views: 1378
Reputation: 243
I don't know if this will make a big enough difference, but since you're dealing with the Django ORM I can suggest the following:
These suggestions will probably make an even bigger difference if you do find yourself using a client-server DBMS.
Upvotes: 3
Reputation: 10351
For MySQL imports:
mysqlimport [options] db_name textfile1 [textfile2 ...]
For SQLite3 imports:
ref How to import load a .sql or .csv file into SQLite?
Upvotes: 4