I have a legacy table that I’m trying to update. It has an integer primary key that works fine for most of what I’m doing. But, in some situations I need to update a record based on values in 2 other fields. Below is a snippet of the def:
style = Style(longID=True)
idName = 'orderItemId'
orderItemId = IntCol()
orderNumber = IntCol()
lineNumber = IntCol()
What I need to do is find out if the orderNumber/lineNumber combination exists and if so, do an update of the attributes instead of adding a new record.
I suppose I could do a select and return an object and then do a get based on the orderItemId, but that seems cumbersome. Is there something I can do so that I can perform a get against 2 columns, orderNumber and lineNumber in this case, something similar to:
X = OderItem.get(orderNumber=1234, lineNumber=1)