Use cursor.lastrowid
to get the last row ID inserted on the cursor object, or connection.insert_id()
to get the ID from the last insert on that connection.
More Related Contents:
- Bulk insert with SQLAlchemy ORM
- How to move a model between two Django apps (Django 1.7)
- What’s the difference between MySQLdb, mysqlclient and MySQL connector/Python?
- django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
- How can I connect to MySQL in Python 3 on Windows?
- Python & MySql: Unicode and Encoding
- Authentication plugin ‘caching_sha2_password’ is not supported
- How to disable SQLAlchemy caching?
- Setting Django up to use MySQL
- memory-efficient built-in SqlAlchemy iterator/generator?
- How can I insert data into a MySQL database?
- How to use MySQLdb with Python and Django in OSX 10.6?
- When to close cursors using MySQLdb
- How to enable MySQL client auto re-connect with MySQLdb?
- How to implement “autoincrement” on Google AppEngine
- Import psycopg2 Library not loaded: libssl.1.0.0.dylib
- Python MySql Insert not working
- Python: MySQLdb and “Library not loaded: libmysqlclient.16.dylib”
- How to filter (or replace) unicode characters that would take more than 3 bytes in UTF-8?
- trapping a MySql warning
- How to see the raw SQL queries Django is running?
- python logging to database
- Simple Subquery with OuterRef
- Django: Increment blog entry view count by one. Is this efficient?
- Reverse engineer SQLAlchemy declarative class definition from existing MySQL database?
- Python’s MySqlDB not getting updated row
- Django + MySQL on Mac OS 10.6.2 Snow Leopard
- Imploding a list for use in a Python MySQL IN clause
- Single Django model, multiple tables?
- How to disable query cache with mysql.connector