Re: insert_id
Baptiste <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Yes, it works, thanks. Damage that we can found this feature only in the DB Api and not in the doc, I have been looking for it since yesterday ! Regards Baptiste 2006/12/29, Gerhard Häring <[email protected]>: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Baptiste wrote: > > Hello, > > > > I need to get back the id which sqlite has attributed (AUTOINCREMENT > > field) to the last recording done. > > TRAC mentions that feature : > > http://www.initd.org/tracker/pysqlite/changeset/9 > > <http://www.initd.org/tracker/pysqlite/changeset/9> but when I use it, I > > have the error 'pysqlite2.dbapi2.Connection' object has no attribute > > 'insert_id' > > How can I do ? I'm using pysqlite 2. > > That was a MySQLdb compatibility feature for pysqlite 1.x. What you're > looking for is the lastrowid property of the cursor object, which will > work > for pysqlite 1.x, pysqlite 2.x and any other DB-API compliant database > module. > > - -- Gerhard > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.3 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFFlTlqdIO4ozGCH14RAg/QAJ4ylzW6pK0+k+IscDdE+bggEgub3gCeLL1X > 5MHMJ/fezb11zIM2usJl3ik= > =3foK > -----END PGP SIGNATURE----- > _______________________________________________ > pysqlite mailing list > pysqlite-IAPFreCvJWPBWskQ1e/[email protected] > http://lists.initd.org/mailman/listinfo/pysqlite > _______________________________________________ pysqlite mailing list pysqlite-IAPFreCvJWPBWskQ1e/[email protected] http://lists.initd.org/mailman/listinfo/pysqlite