Categories
mysql postgresql python sqlalchemy

Python SQLAlchemy get returning ID after inserting

I want to get the ID of the last inserted record after inserting in postgresql using SQLAlchemy. Here is code,

insert_record = {list of data}
result = connection.execute(tbl_example.insert().returning(tbl_example.c.id), insert_record)
print result.id

The inserting does fine but I can’t seem to get the ID of the last inserted, I get the following error,

AttributeError: ‘ResultProxy’ object has no attribute ‘id’

Where is the return ID located in the returning object?