sqlalchemy flush() and get inserted id?

前端 未结 6 2020
北海茫月
北海茫月 2020-12-07 11:20

I want to do something like this:

f = Foo(bar=\'x\')
session.add(f)
session.flush()

# do additional queries using f.id before commit()
print f.id # should b         


        
6条回答
提交回复
热议问题