Hi,
I'm wondering and cannot figure out how I can get last_inserted_id
when I'm working with sessions. For example I defined table and mapper
to my user class (e.g. User)

user = Table('user', engine,
          Column('id', Integer, primary_key=True,  nullable = False),
          Column('name', String(16),  nullable = False)
  )
class User(object):
        def __init__(self, name = None):
        self.name = name

mapper(User, user)

So, I define
session = create_session()
u = User('test')
session.save(u)
session.flush()

and now I want to return back the id from user table. How I can do that.

-- 
Thank you,
Valentin


_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to