tonthon <[email protected]> wrote:

> Sorry I was a bit too speed when writing that one :)
> 
> So I've got a Base model :
> """
> class Base(DBBASE):
>    __tablename__ =
> 'base'                                                     
>    __mapper_args__ = {'polymorphic_identity': 'base', 'polymorphic_on':
> 'type_'}      
>    id = Column(Integer, primary_key=True)
>   name = Column(String(255))
>   description = deferred(
>       Column(Text()),
>       group="full"
>   )
>    type_ = Column( String(30), nullable=False)
> """
> 
> and a child model
> """
> class Element(DBBASE):
>    __tablename__ = 'element'
>    __mapper_args__ = {'polymorphic_identity': 'element'}
>    id = Column(ForeignKey("base.id"))
>   comments = deferred( Column(Text()), group="full", )
> """
> 
> The following query :
> """
> Element.query().options(undefer_group('full')).all()
> """
> 
> doesn't load the description column, is that the expected behaviour ?

When you say “a child model Element”, that’s not what I see. Element and
Base are both descending from DBBASE. If Element were a child of Base, it
would need to be declared as “class Element(Base)”.

As it is, it is expected because the “Element” class does not have a column
called “description”. If you were to load objects of type “Base”, then you’d
see “description”.


-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to