lastrowid

Djagno

MySQL

Syntax:

id = cursor.lastrowid

Doc:

This read-only property returns the value generated for an AUTO_INCREMENT column 
by the previous INSERT or UPDATE statement or None when there is no such value available. 
For example, if you perform an INSERT into a table that contains an AUTO_INCREMENT column, 
lastrowid returns the AUTO_INCREMENT value for the new row.

References

[1] Blairg23@StackOverflow, Python mysql.connector cursor.lastrowid always returns 0

results matching ""

    No results matching ""