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
two issues are 1. the "asdecimal"-ness of an expression being maintained, which goes beyond Float and 2. Float having it's own affinity
from sqlalchemy import Float, Integer, literal
expr = literal(5, Integer) * literal(4.5, Float)
assert expr.type.asdecimal is False
assert expr.type is Float
option are to give Float its own _type_affinity, but then that only works for Float and not Numeric with asdecimal=False type affinity and also that would be the single example of two levels of _type_affinity Numeric/Float so not sure I like that.
I think we should use something other than _type_affinity in _DateAffinity._adapt_expression that can deliver more specificity, and leave _type_affinity alone since this is not as much about Python datatypes.
also why are the logic used for numeric -> numeric type adaptations encapsulated in _DateAffinity, that just looks bad, rename that to something.
The text was updated successfully, but these errors were encountered:
The rules for type coercion between :class:.Numeric, :class:.Integer,
and date-related types now include additional logic that will attempt
to preserve the settings of the incoming type on the "resolved" type.
Currently the target for this is the asdecimal flag, so that
a math operation between :class:.Numeric or :class:.Float and
:class:.Integer will preserve the "asdecimal" flag as well as
if the type should be the :class:.Float subclass.
Migrated issue, originally created by Michael Bayer (@zzzeek)
continuing from #4017
two issues are 1. the "asdecimal"-ness of an expression being maintained, which goes beyond Float and 2. Float having it's own affinity
option are to give Float its own _type_affinity, but then that only works for Float and not Numeric with asdecimal=False type affinity and also that would be the single example of two levels of _type_affinity Numeric/Float so not sure I like that.
I think we should use something other than _type_affinity in _DateAffinity._adapt_expression that can deliver more specificity, and leave _type_affinity alone since this is not as much about Python datatypes.
also why are the logic used for numeric -> numeric type adaptations encapsulated in _DateAffinity, that just looks bad, rename that to something.
The text was updated successfully, but these errors were encountered: