Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get primary keys inserted after executemany

Tags:

python

mysql

I am using MySQLdb in python 3 to insert multiple rows using executemany.

Now I need to get the primary keys after the multi insert..

Is there any way to get them?

like image 581
Amal Avatar asked Nov 19 '25 01:11

Amal


1 Answers

You can use connection.insert_id()

like image 78
Adem Öztaş Avatar answered Nov 21 '25 15:11

Adem Öztaş



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!