mysql-python: How can I retrieve the ID of the last record I added?

Gabriel Ambuehl gabriel_ambuehl at buz.ch
Fri Sep 28 09:46:27 EDT 2001


-----BEGIN PGP SIGNED MESSAGE-----

Hello,
I've got a MySQL table which has got an id field that is declared as
auto_increment so every record added gets its own unique id. So far
so
good, but how can I fetch the id of the last record added? I know I
can do some SELECT to gather the ID but if there are two completely
identical records, which is possible, it won't do me any good. So is
there some library function to reliably retrieve the id of the last
record I inserted into the table?




Best regards,
 Gabriel

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5i

iQEVAwUBO7RxJ8Za2WpymlDxAQE94wgAl/cJHrvUyi53sdXC5UD77yJefWHtyI+/
hm7W7uI+LQy9Y5vdq5UY1MADK0V4NaGlzjI3AvdbsRBxNlcqPqxWodJrmyxiXEYt
uQLoHNGGdjhxUN+C1QgK1wEi4pDleh3TMLDNChurFIhxncxWyhRNULZwXR20qrj4
xR6vlF59H2oxf38TiBIQHRWDMXK4ZstZyyVsxQDUYDuzwUfFx4Qf22+1QVHUHe6l
aFTANSOc1IbnJXqVHcCvCqlwne2/h84PhQ4YKRFwvrh0rN2EQ3YiatYHyDHq5In6
5YzE8UwHu5kWCyD0pQ2I2Pm1UcHw6P/OA82687PWjFKpuEjnlhHB1A==
=Ku3P
-----END PGP SIGNATURE-----





More information about the Python-list mailing list