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
When Pony generates for an Entity a field that has not been specified by the user in the class definition (I know of this behavior only for Entity subclasses that do not specify a PrimaryKey field), there is currently no straightforward way to now whether that field was specified by the user or generated by Pony.
Would it be possible to have an is_implicit (or any better name) field in Attribute that is False except when the field was generated by Pony, like in the case of an implicit primary key?
The text was updated successfully, but these errors were encountered:
In case of inheritance, it is discriminator attribute which can be implicit. Pony uses the value of discriminator attribute in order to determine a Python class which correspond to the specific database row:
You may wonder why the value of p1._discriminator_attr_ is 1 here and not Person.kind. This is because in Pony each attribute is a descriptor, and when descriptor accessed from the object instance, the value of descriptor.__get__(obj) is returned and not the descriptor itself. In order to retrieve discriminator attribute of specific entity instance in a generic way, you can write obj.__class__._discriminator_attr_.
When Pony generates for an
Entity
a field that has not been specified by the user in the class definition (I know of this behavior only forEntity
subclasses that do not specify aPrimaryKey
field), there is currently no straightforward way to now whether that field was specified by the user or generated by Pony.Would it be possible to have an
is_implicit
(or any better name) field inAttribute
that isFalse
except when the field was generated by Pony, like in the case of an implicit primary key?The text was updated successfully, but these errors were encountered: