the entity_name feature is somewhat broken in 0.4 and has been removed
entirely in 0.5 - there's too much ambiguity in its usage (namely, the
attributes/behavior of a class cannot be determined until the class is
associated with a specific mapper via the session). Its possible
that this is related to the issue you're having.
What is preventing you from simply mapping different classes ?
On Oct 13, 2008, at 11:31 AM, [EMAIL PROTECTED] wrote:
>
>
>
> I use entity_name's for all mappers. So I dont have mappers with
> entity_name = None.
>
> With sqlalchemy 0.4 I run into errors if I try to add objects to
> InstrumentedList's:
>
> (Pdb) len( self.users )
> 1
> (Pdb) self.users
> [<common.User object at 0x1d1992a8>]
> (Pdb) type( self.users )
> <class 'sqlalchemy.orm.collections.InstrumentedList'>
> (Pdb) self.users.append( user )
> File "SQLAlchemy-0.4.8-py2.4.egg/sqlalchemy/orm/collections.py",
> line 921, in append
> item, _sa_initiator)
> File "SQLAlchemy-0.4.8-py2.4.egg/sqlalchemy/orm/attributes.py", line
> 517, in fire_append_event
> ext.append(instance, value, initiator or self)
> File "SQLAlchemy-0.4.8-py2.4.egg/sqlalchemy/orm/attributes.py", line
> 713, in append
> getattr(child.__class__, self.key).impl.append(child._state,
> instance, initiator, passive=True)
> File "SQLAlchemy-0.4.8-py2.4.egg/sqlalchemy/orm/attributes.py", line
> 294, in append
> self.set(state, value, initiator)
> File "SQLAlchemy-0.4.8-py2.4.egg/sqlalchemy/orm/attributes.py", line
> 437, in set
> old = self.get(state)
> File "SQLAlchemy-0.4.8-py2.4.egg/sqlalchemy/orm/attributes.py", line
> 278, in get
> callable_ = self._get_callable(state)
> File "SQLAlchemy-0.4.8-py2.4.egg/sqlalchemy/orm/attributes.py", line
> 255, in _get_callable
> return self.callable_(state.obj())
> File "SQLAlchemy-0.4.8-py2.4.egg/sqlalchemy/orm/strategies.py", line
> 318, in class_level_loader
> localparent = mapper.object_mapper(instance)
> File "SQLAlchemy-0.4.8-py2.4.egg/sqlalchemy/orm/util.py", line 371,
> in object_mapper
> raise exceptions.InvalidRequestError("Class '%s' entity name '%s'
> has no mapper associated with it" % (object.__class__.__name__,
> getattr(object, '_entity_name', entity_name)))
> InvalidRequestError: Class 'User' entity name 'None' has no mapper
> associated with it
>
>
> It is a mistake on my part or a bug/broken feature (I migrate from
> sqlalchemy 0.3 and it works with 0.3)?
>
> thanks and greetings,
> tyr
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---