sqlalchemy insert and return id code example
Example 1: sqlalchemy return id after insert
f = Foo(bar='x')
session.add(f)
session.flush()
print(f.id) # will return the obj id
Example 2: sqlalchemy return id after insert
session.flush()
print(f.id)