Little update:
If I remove "self.__dict__ = self" from _Struct definition exception
is not raised.
This is the original base class:
class _Struct(dict):
def __init__(self,**kw):
dict.__init__(self, kw)
self.__dict__ = self
On Feb 22, 12:20 pm, Andrea <[email protected]> wrote:
> Hi all,
> I have some object on a pre-existing model. Now we want to add a
> persistance layer and so SQLAlchemy/SQLite will be our choice.
> When I add an object to session a UnmappedInstanceError is raised:
> Class 'try_sqlalchemy.example2.applib_model.DescriptorBean'
> is mapped, but this instance lacks instrumentation. This occurs when
> the instance
> is created before
> sqlalchemy.orm.mapper(try_sqlalchemy.example2.applib_model.DescriptorBean)
> was called.
>
> This is the example, three code snippets from three python
> modules:http://pastebin.com/KLFFN3ke
>
> On debug I see that the DescriptorBean instance is created after the
> mapping (mapping is created on startup.createSchema method) so I don't
> understand the error message.
> The same problems if I use declarative and inherit from Base (class
> DescriptorBean(Base, _Struct)). No problems if I have a class that
> inherits directly from object. Maybe is _Struct inheritance that
> destroys mapper instrumentation? Any suggestion?
>
> Thanks,
> Andrea
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.