With a mapped class instance, if I try and set an unmapped attribute, Sqlalchemy simply adds this new attribute (locally) to the object, and subsequent 'get' operations return the assigned value.
Base = declarative_base()
class MyClass(Base):
__tablename__ = 'some_table'
id = Column(Integer, primary_key=True)
...
obj = MyClass()
## This correctly raises 'AttributeError'
print obj.unmapped_attribute
## This does not fail!
obj.unmapped_attribute = 0
## Also does not fail anymore, prints "0"
print obj.unmapped_attribute
I'd like to have an 'AttributeError thrown whenever I try and set a bad property, similar to the getattr() behavior. Is this possible? Maybe I'm doing something wrong?
(Using SqlAlchemy 0.7.9, Python 2.7)