For brevity I am just giving an example table and no other configuration.
class Widget(Base):
id = Column(Integer, primary_key=True)
#Setup/config logic goes here.
# assume session object exists.
thing = Widget()
thing.foo = "bar"
#ideally throw atleast a warning that `foo` doesn't exist
session.add(thing)
Sqlalchemy will ignore foo
being assigned to the record instance, I can understand why, but is there someway to catch these assignments?
Would I need to add my own __init__
with some sort of getattr to implement a freeze/lock logic to the class or does sqlalchemy have something like this provided?
I caught a typo in my code where I meant to assign to a net_amount
field and instead assigned to the non-existent met_amount
and would like to somehow catch these bugs before they get to far out of control.