Bu sadece Python PyMySql bir gereksinimi olabilir, ama ben kimliği istediğim kesin tabloyu adlandırmak zorunda bulundu:
İçinde:
cnx = pymysql.connect(host='host',
database='db',
user='user',
password='pass')
cursor = cnx.cursor()
update_batch = """insert into batch set type = "%s" , records = %i, started = NOW(); """
second_query = (update_batch % ( "Batch 1", 22 ))
cursor.execute(second_query)
cnx.commit()
batch_id = cursor.execute('select last_insert_id() from batch')
cursor.close()
batch_id
Çıkan: 5
... veya gerçekte doğru Batch_ID değeri ne olursa olsun