You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is similar to the issue from 2019 #1969. We are using a base class to define a couple of fields and related hybrid properties so that we can reuse it across multiple models. We've found that if we alias the model then the hybrid properties (and hybrid methods) don't use the alias and instead use the base class.
The resulting query is SELECT ("t1"."end" - "t1"."start") FROM "interval" AS "t2"
I've debugged it down to ModelAlias.__getattr__ and obj = self.model.__dict__[attr]. My understanding is that inherited properties are not in the class' __dict__ so that code will throw the KeyError.
Is there a way to address this?
Thanks!
The text was updated successfully, but these errors were encountered:
peewee 3.17.3
This is similar to the issue from 2019 #1969. We are using a base class to define a couple of fields and related hybrid properties so that we can reuse it across multiple models. We've found that if we
alias
the model then the hybrid properties (and hybrid methods) don't use the alias and instead use the base class.Example:
The resulting query is
SELECT ("t1"."end" - "t1"."start") FROM "interval" AS "t2"
I've debugged it down to
ModelAlias.__getattr__
andobj = self.model.__dict__[attr]
. My understanding is that inherited properties are not in the class'__dict__
so that code will throw theKeyError
.Is there a way to address this?
Thanks!
The text was updated successfully, but these errors were encountered: