[Sqlalchemy-tickets] Issue #4018: maintaining float type affinity (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
From: Michael B. <iss...@bi...> - 2017-06-25 16:08:26
|
New issue 4018: maintaining float type affinity https://bitbucket.org/zzzeek/sqlalchemy/issues/4018/maintaining-float-type-affinity Michael Bayer: 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 ``` #!python 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. |