25👍
✅
Sure it will, it’ll know the ID as soon as the command finishes, that’s how RETURNING is implemented. You need to actually fetch it though, so something like:
cursor.execute("INSERT INTO .... RETURNING id")
id_of_new_row = cursor.fetchone()[0]
should work in your scenario.
- Download files from Amazon S3 with Django
- Postgis isn't an available database backend
- Django-import-export – import of advanced fields?
Source:stackexchange.com