Michael,

On Wed, Aug 27, 2008 at 1:18 PM, Michael Bayer <[EMAIL PROTECTED]>wrote:

>
>
> On Aug 27, 2008, at 2:25 AM, manuhack wrote:
>
> >
> > Hi,
> >
> > Using the example in the tutorial:
> >
> >>>> users = Table('users', metadata,
> > ...     Column('id', Integer, primary_key=True),
> > ...     Column('name', String),
> > ...     Column('fullname', String),
> > ... )
> >
> > if I commit the following
> >
> >>>> ins = users.insert(values={'name':'jack', 'fullname':'Jack Jones'})
> >>>> conn = engine.connect()
> >>>> result = conn.execute(ins)
> >
> > is there a way to get the value of "id" without calling select?  I'm
> > using MySQL if that matters.  Thanks!
>
> yes, call result.last_inserted_ids() .  This is independent of
> database backend and returns a list of primary key identifiers for a
> single row (usually a single element).
>

Thanks a lot, this is exactly what I was looking for!

manu

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to