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 ?
Regards
Le 16/03/2015 17:21, Michael Bayer a écrit :
>
> tonthon <[email protected]> wrote:
>
>> Hi,
>>
>> I'm using polymorphism and I set up some deferred columns at each level
>> of inheritance belonging to the same deferred group :
>>
>> """
>> class Base(DBBASE):
>> id = Column(Integer, primary_key=True)
>> name = Column(String(255))
>> description = deferred(
>> Column(Text()),
>> group="full"
>> )
>>
>> class Element(DBBASE):
>> id = Column(ForeignKey("base.id"))
>> comments = deferred(
>> Column(Text()),
>> group="full",
>> )
>> """
>>
>> The following query :
>>
>> """
>> Element.query().options(undefer_group('full')).all()
>> """
>>
>> doesn't defer the description column, is that the expected behaviour ?
> a query for Element here will not load objects of type “Base”, so I don’t see
> where “description” comes into play.
>
> If you can provide a more complete example that would help.
>
>
--
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.