Josh Stratton wrote: > > AttributeError: 'MyObject' object has no attribute '_state' > > I don't see any _state printed out. The only additional attribute I > see is the 'c' variable, where pull tables from. What is causing this > _state thing to appear? Do I need to call class_mapper after each > mapper only only once after any mapper?
this error indicates that an instance of "MyObject" was instantiated before mappers were created. In your example you're accessing "myObjectInstance" however I don't see where that's being instantiated, so the fact that the mapper is set up just above would be the cause. the configuration of mappers (note that this does not include the configuration of engines or sessions - just mappers) should occur at application start time as closely as possible to the point at which the classes themselves have been defined. This is one reason the "declarative" extension has been popular, since it performs both at the same time by definition. > > Thanks. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---