Hi all,

I need to insert a new row and get back the last inserted id,
I have some difficulty using the flush(), then I'm trying with commit() but
I can't understand how commit() works in 0.6.
In the following script I try to update a row and it works properly
but when I try to insert a new one, it doesn't work,
there's no messages but the row is not inserted into the table.
Is this the right way ?


from sqlalchemy.orm import sessionmaker
Session = sessionmaker(autoflush=True)
session = Session()

#update an existing row... it works
old = Specie.get('D')
old.specie_descrizione='dog'

#insert a new row... it doesn't work
new=Specie(
   specie_codice='C',
   specie_descrizione='cat'
)

session.commit()

thanks for any help

j

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

Reply via email to