Parallel insert to postgresql with thread

Jean-Paul Calderone exarkun at divmod.com
Thu Oct 25 13:31:45 CEST 2007


On Thu, 25 Oct 2007 04:00:44 -0700, Abandoned <besturk at gmail.com> wrote:
>Hi..
>I use the threading module for the fast operation.

For fast operation, avoid the threading module.  Here's a code sample:

    conn = connect(...)
    cursor = conn.cursor()
    cursor.executemany("INSERT INTO keywords (keyword) VALUES (%s)", datas)

Note that I also corrected your use of %, which was unnecessarily complex and
insecure.

Jean-Paul



More information about the Python-list mailing list