Reputation: 71
Use asyncpg to execute the insert statement in Python, and use the returning id syntax to get the ID of each insert, but return the "INSERT 0 1"
Python 3.5
asyncpg (Using Connection Pool)
Upvotes: 2
Views: 2727
Reputation: 1274
Connection.fetch()
(and its variants) can be used to return the results of any data-returning statement, including INSERT ... RETURNING id
or INSERT ... RETURNING *
if you need all columns.
Upvotes: 8