Hi,
I create a certain number of objects in a loop, I check if each of the
objects is already stored in the session and if it is not I add it to
the session.

session = Session()
for item in items:
   item1=create_item()
   if not item1 in session:
       session.add(item1)
session.commit()

The problem is that when I add two objects to the session that are not
the same but have some id I get the error:
get an error sqlalchemy.exc.IntegrityError: (IntegrityError) duplicate
key value violates unique constraint
Is there any function that directly checks if there two objects with
the same id in a session?
Thanks

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to