On Apr 27, 2:34 pm, "Paul Hemans" <dar...@nowhere.com> wrote:
> entry = schema.BILLS() > exists = session.query(schema.BILLS).filter(schema.BILLS.REFNO==u"1") > if exists.count == 0: > entry.REFNO = u"1" > entry.THRDPTY = u"""C5""" > entry.AMOUNT = 0 > entry.TIMESTAMP = 0 > entry.ALLOCATED = 0 Instead of generating code like that, you can do it dynamically. The built-in setattr() function is your friend, e.g. for col_name in col_names: if needs_updating(col_name): value = get_new_value(col_name) setattr(entry, col_name, value) > session.add(entry) > > session.commit() > session.close() Cheers, John -- http://mail.python.org/mailman/listinfo/python-list