sqlalchemy return id after insert

Solutions on MaxInterview for sqlalchemy return id after insert by the best coders in the world

showing results for - "sqlalchemy return id after insert"
Greta
04 Jan 2018
1session.flush()  
2print(f.id)
Marco
23 Mar 2017
1f = Foo(bar='x')
2session.add(f)
3session.flush()
4
5print(f.id) # will return the obj id