Re: [sqlalchemy] How to get id from newly inserted row

2015-11-30 Thread Sami Pietilä
Thank you! This kind of approach seems to work well: ins = records.insert().returning(records.c.id) result = connection.execute(ins) row = result.fetchone() sunnuntai 29. marraskuuta 2015 18.53.48 UTC+2 Michael Bayer kirjoitti: > > > > On 11/29/2015 10:50 AM, Sami Pietilä wrote: > > Hi, > >

Re: [sqlalchemy] How to get id from newly inserted row

2015-11-29 Thread Mike Bayer
On 11/29/2015 10:50 AM, Sami Pietilä wrote: > Hi, > > I have postgresql database with "records" table. There is "id" > (bigserial unique primary key) column. I need to insert a row in such a > way that I get id from newly inserted row. > > ins = records.insert() > results = conn.execute(ins) >

[sqlalchemy] How to get id from newly inserted row

2015-11-29 Thread Sami Pietilä
Hi, I have postgresql database with "records" table. There is "id" (bigserial unique primary key) column. I need to insert a row in such a way that I get id from newly inserted row. ins = records.insert() results = conn.execute(ins) I was unable to find a code example of how to add