>>> 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. > > Okay, that seemed to work. Thanks. A mapper() call followed by a > class_mapper() call for each database did the trick.
Just to be sure, but would using a mapper setup as described above prevent normal autoincrementing for merge's or saveOrUpdate's into a table or do those only work with straight inserts? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---