Re: idiom for inserting multiple rows with auto-increment IDs

"Daniel Lenski" <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
In 8/19/07, Dennis Lee Bieber <[email protected]> wrote:
>
> Otherwise, if you need to allow for multiple accessors and thereby need
> short transactions... You are back to the original
>
> for data in rowSource:
>         cur.execute("""insert into aTable (c1, c2, c3)
>                                         values (?, ?, ?)""",
>                                 (data.c1, data.c2, data.c3))
>         id = cur.lastrowid
>         con.commit()


Thanks, Dennis!  I guess that's that then.  Somehow it seems frustratingly
"unpythonic" not to be able to do the whole sequence at once with
auto-updating IDs.  I guess the pythonic way to do it would be to use
Sqlobject or something. :-)

Dan

_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/pysqlite
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.