Python Forum
Convert SQLite Fetchone() Result to float for Math
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert SQLite Fetchone() Result to float for Math
#14
I think it is a bad idea to verify actual values returned from a database query. Maybe 0 can be, or worse is a valid sell price. The future maintainer of your code will be confused that database queries for free items always fail and they will curse you when they find the reason is buried deep in some method.

Verify values before you put them in the database. Verify that a query found a match. Assume values returned by the query are correct.
Reply


Messages In This Thread
RE: Convert SQLite Fetchone() Result to float for Math - by deanhystad - Aug-02-2022, 01:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python calculate float plus float is incorrect? sirocawa 6 451 Apr-16-2024, 01:45 PM
Last Post: DeaD_EyE
  convert result to hex ascii Jusufs 6 1,668 May-19-2023, 03:21 PM
Last Post: deanhystad
  math formula does not give the same result as bash script [SOLVED] AlphaInc 3 1,033 Apr-02-2023, 07:21 PM
Last Post: AlphaInc
  convert string to float in list jacklee26 6 2,013 Feb-13-2023, 01:14 AM
Last Post: jacklee26
  openpyxl convert data to float jacklee26 13 6,276 Nov-19-2022, 11:59 AM
Last Post: deanhystad
  Convert string to float problem vasik006 8 3,511 Jun-03-2022, 06:41 PM
Last Post: deanhystad
  math.log versus math.log10 stevendaprano 10 2,516 May-23-2022, 08:59 PM
Last Post: jefsummers
  Why getting ValueError : Math domain error in trig. function, math.asin() ? jahuja73 3 3,854 Feb-24-2021, 05:09 PM
Last Post: bowlofred
  SQL and fetchone Scorpio 6 6,662 Oct-14-2020, 02:24 PM
Last Post: beebert69
  ValueError: could not convert string to float: RandomCoder 3 5,831 Jul-27-2020, 07:38 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020