On Aug 20, 2:50 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Thu, Aug 20, 2009 at 1:46 PM, Abiel<abi...@gmail.com> wrote:
>
> > Is there an efficient way to use Django models to load a large number
> > of records into a database without falling back on raw SQL? Creating a
> > large number of model objects and then saving each one individually is
> > very slow (I imagine Django is running INSERT and COMMIT each time?).
>
> > Thanks very much.
>
> Django doesn't currently support any form of bulk insert.  Using raw
> SQL is your best option at this point.
>

I also am trying to do a bulk load, but has to be written in Python.
It is a two pass loading procedure, where the first pass could be done
with the indexes turned off, and the second pass with them on.

Is there a way to disable indexes momentarily and then turn them back
on? Or can I manage the transactions to do saves in bulk in the first
pass?

Thanks for any pointers!

-Doug

> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
> "The people's good is the highest law." -- Cicero
> "Code can always be simpler than you think, but never as simple as you
> want" -- Me
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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