Thanks. I couldn't make the sqlite3 shell work on windows command
prompt, so I cannot use .import.

> read the csv with csv.DictReader, then create instances of my model
> with the values from the resulting dictionary, then calling a .save() on
> the new instance.

Do you have more detailed instructions on this method?

On Dec 10, 12:08 pm, Shawn Milochik <sh...@milochik.com> wrote:
> There are different ways to do it, depending on how much data you have and 
> how often you plan to do it.
>
> The fastest way for large files is to use sqlite3's .import command to 
> directly import a file. However, this will bypass any validation done by your 
> models.
>
> The way I do it is to read the csv with csv.DictReader, then create instances 
> of my model with the values from the resulting dictionary, then calling a 
> .save() on the new instance. This is fairly slow, but thorough; you won't 
> realize belatedly that your database is missing required fields or has 
> invalid values, because the script will just blow up if you try.
>
> Shawn

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to