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
Looking at ColanderAlchemy it looks like it ignores the asdecimal flag. You could submit a PR, but no one is actively maintaining this library right now.
Why don't you use Float or Numeric without the asdecimal setting? I don't really understand the purpose of switching back and forth between float and Decimal (which will essentially lose precision).
We only use Decimal in the computation modules to avoid rounding problems. It works well this way.
Switching to another behaviour would be a large work that is far to be a priority on our roadmap.
In our app, we always customize the generated colander schema when asking for it, we added a hack in that part to solve our problem.
Maybe I'm misunderstanding, but if you're using Decimal then use use Numeric and keep everything as a Decimal. If you use Numeric(7,5, asdecimal=False) then you're converting to a float and can possibly lose precision. In general it seems like you should use Numeric when you want to do everything in Decimal and Float when you want to do everything in float. The asdecimal flag causes a type coercion (it seems like it's purpose is for database engines that don't support particular data types).
Given the following model
The generated schema node for quantity is of type colander.Decimal
It should be colander.Float.
In my case I found a turnaround by setting the typ afterwards.
The text was updated successfully, but these errors were encountered: