kennethreitz / records

SQL for Humans™
https://pypi.python.org/pypi/records/
ISC License
7.15k stars 570 forks source link

How to get the ID of the data after the insert into #152

Closed huawan2018 closed 6 years ago

CamiloGarciaLaRotta commented 5 years ago

For anyone wondering, I had the same question: If you are using Postgres you can add a RETURNING <field> statement at the end of your INSERT. Then you can query back the DB with the returned field (e.g. id)