I see. Thanks a lot for the quick response!
I'll be looking forward to 1.2.3. Le jeudi 15 février 2018 18:01:38 UTC-5, Mike Bayer a écrit : > > On Thu, Feb 15, 2018 at 4:48 PM, Charles Langlois <cha...@konversion.ca > <javascript:>> wrote: > > I believe my problem is related to > > https://bitbucket.org/zzzeek/sqlalchemy/issues/4124. > > > > I have an AbstractConcreteBase inheritance hierarchy that looks like > this: > > > > class AbstractBase(AbstractConcreteBase, Base): > > @declared_attr > > def column1(cls): > > return Column(...) > > > > @declared_attr > > def column2(cls): > > return Column(...) > > > > > > class Concrete1(AbstractBase): > > __tablename__ = "concrete1" > > > > attribute1 = Column(...) > > > > __mapper_args__ = { > > 'polymorphic_identity': 'concrete1', > > 'concrete': True > > } > > > > class Concrete2(AbstractBase): > > __tablename__ = "concrete2" > > > > @hybrid_property > > def attribute1(self): > > return ... > > > > @attribute1.expression > > def attribute1(cls): > > return ... > > > > __mapper_args__ = { > > 'polymorphic_identity': 'concrete2', > > 'concrete': True > > } > > > > Then, if I refer to `attribute1` on an instance if Concrete2, I get an > > AttributeError: > > > > ... > > File "/home/charles/PycharmProjects/MyProject/models/setup/model.py", > line > > 350, in generate_seasonality > > x = concrete2_instance.attribute1 > > File > > > "/home/charles/PycharmProjects/Konversion_Platform-Back-End/.env/lib/python3.6/site-packages/sqlalchemy/orm/attributes.py", > > > > line 298, in __get__ > > return self.descriptor.__get__(instance, owner) > > File > > > "/home/charles/PycharmProjects/Konversion_Platform-Back-End/.env/lib/python3.6/site-packages/sqlalchemy/orm/descriptor_props.py", > > > > line 512, in __get__ > > warn() > > File > > > "/home/charles/PycharmProjects/Konversion_Platform-Back-End/.env/lib/python3.6/site-packages/sqlalchemy/orm/descriptor_props.py", > > > > line 500, in warn > > (self.parent, self.key, self.parent)) > > AttributeError: Concrete Mapper|Concrete2|concrete2 does not implement > > attribute 'attribute1' at the instance level. Add this property > explicitly > > to Mapper|Concrete2|concrete2. > > > > I'm running SQLAlchemy 1.2.2. If the problem is indeed the same as in > > https://bitbucket.org/zzzeek/sqlalchemy/issues/4124 , then I believe it > was > > supposed to have been fixed in 1.2.0. > > 4124 has to do with loading objects and is not what is happening here. > This is the hybrid property you are creating is getting partially > blown away during the instrumentation phase, because the mapper is not > checking that this attribute was mapped outside of the kinds of > attributes the mapper looks for. > > issue > https://bitbucket.org/zzzeek/sqlalchemy/issues/4188/mapper-places-concreteinheritedproperty-on > > is added and the fix is running through gerrit to be available in > 1.2.3. > > > > > > > > Thanks for any help! > > > > -- > > SQLAlchemy - > > The Python SQL Toolkit and Object Relational Mapper > > > > http://www.sqlalchemy.org/ > > > > To post example code, please provide an MCVE: Minimal, Complete, and > > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > > 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 sqlalchemy+...@googlegroups.com <javascript:>. > > To post to this group, send email to sqlal...@googlegroups.com > <javascript:>. > > Visit this group at https://groups.google.com/group/sqlalchemy. > > For more options, visit https://groups.google.com/d/optout. > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.