Hi,
I guess I am doing something wrong but looking on 'raw' SQL it looks
fine.
My code:
session = Session()
order = session.query(dbOutOrder).get(2)
for line in order.lines:
session.delete(line)
session.flush()
#session.commit()
for i in range(1,10):
line = dbOutLine()
line.HEADER_id = order.id
line.ITEM_SKU_id = 1
line.QTY = 1
order.lines.append(line)
session.add(order)
session.flush()
i = 0
for line in order.lines:
if i % 2 == 0:
print "DELETE"
session.delete(line)
i += 1
# new_order = order.copy()
# new_order.NUMBER = "A" + strftime("%Y%m%dT%H%M%S")
#
# print new_order, new_order.lines
#
# session.add(new_order)
# #session.flush()
#
# print new_order, new_order.lines
session.commit()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---