-1
Well, I have a python script that queries two different databases to verify values per day, one in SQLSERVER and the other in Postgres.
I used an if to warn if the values were different and if it is, warn.
What happens and what was alarming even I consulting in the base that they were equal.
When printing the result of the variables of the script I came across this
How do I get value only, without decimal and character information and format for only 2 decimal places?
Those two lines you posted that were compared to each other? Did you notice that the first is a list and the second is a tuple? Couldn’t that be the problem?
– Woss
And if you want to compare, and the data is interpreted as float, you don’t use equality, and yes
valor-absoluto(a-b) < 0.0000...0001
(acceptable accuracy), or simply take the data as integers. (although, looking at the Decimal class, probably its error is in if and has nothing to do with what was described in the question)– Bacco
On Bacco’s commentary, there is
math.isclose
which may be used for such a purpose.– Woss
The way it is, we don’t have enough data to help. Click on [Edit] and post the comparison code so we can understand the problem and the complete output of your debug in text, not image, so the community can help more objectively.
– Bacco