greetings,

i'm batch processing xml documents to mysql using SA 0.5, ORM.

data extracted from xml docs may be new or an update in form of a
replacement of
the existing object (record). (one of the columns, product_id, is
unique=True). Hence,
SA throws, as expected, an IntegrityError (1062, duplicate Entry) when
i'm trying to commit the revised object via session.add(obj),
session.commit().

given the xml volume at hand, i thought i could use session.merge
rather than query every time for existence. alas, no go. get the same
1062 exception. obviously, i don't understand the session merge.

in fact, even if i query for the existence, then try and assign the
new object to the existing object (old_obj = session.query(OBJ).filter
(OBJ.product_id == new_obj.product.id).one(), old_obj = new_obj,
session.add(old_obj), session.commit()), i get the dreaded 1062.

any insights/suggestions?

thx
--~--~---------~--~----~------------~-------~--~----~
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