How to find bad row with db api executemany()?

rusi rustompmody at gmail.com
Fri Mar 29 23:13:48 EDT 2013


On Mar 30, 7:49 am, Chris Angelico <ros... at gmail.com> wrote:
> On Sat, Mar 30, 2013 at 1:44 PM, Roy Smith <r... at panix.com> wrote:
> > The slow way (i.e. "VALUES"), I'm inserting 1000 rows about every 2.4
> > seconds.  When I switch to "values", I'm getting more like 1000 rows in
> > 100 ms!
>
> > A truly breathtaking bug.
>
> *facepalm*
>
> Doubly facepalm because a regex could easily have tested for mixed case.
>
> Especially facepalm because there's some way to do this that's faster
> than straight INSERT statements, and it's not clearly documented as
> "hey, guys, if you want to dump loads of data in, use COPY instead"
> (it might be that, I don't know, but usually COPY isn't directly
> transliterable with INSERT).
>
> I agree. Breathtaking.
>
> ChrisA

I recently heard this:
A phone company needed to send out bulk-smses to its customers. It was
of the order of millions.
A (noob?) python programmer was assigned the task and used django with
whatever is the django orm.
It took of the order of weeks to send out the smses.
A python expert was called in.  He threw out the python and redid it
in SQL.
It was done in minutes.



More information about the Python-list mailing list