My code tests to see if an column on a model is loaded, in part because I merge partial models to perform a sparse update on the database. I do that by checking the __dict__ of the model, though sqlalchemy.inspect also works.
Using SQLAlchemy 0.8.0: import sqlalchemy as sa import sqlalchemy.ext.declarative Base = sa.ext.declarative.declarative_base() class Foo(Base): __tablename__ = 'foos' x = sa.Column(sa.String(36), primary_key=True) foo = Foo() # Test unloaded attribute >>> 'x' in foo.__dict__ False >>> sa.inspect(foo).unloaded set(['x']) # Access attribute >>> foo.x # Test loaded attribute >>> 'x' in foo.__dict__ True >>> sa.inspect(foo).unloaded set([]) However, in sqlalchemy 1.0.10, that is no longer the case. The attribute is still marked as unloaded, and does not appear in the __dict__. Is that intentional, or is it a regression? Setting the attribute marks it as loaded, as expected. I haven't narrowed down the issue to a specific version, because I wasn't sure if it is intentional. (i.e., maybe attributes are only marked as loaded if they are a relationship)? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.