3

What causes this error:

ValueError: microsecond must be in 0..999999

Using Python 3 and pypyodbc version 1.3.5

The query is very simple and has worked for months. I can only stop the error by removing a column of type datetime2(7) with a value: 6/11/2018 10:54:47.9730000 another value that does not produce the error is : 6/22/2018 10:38:35.5630000

Thanks!

tourist
  • 4,165
  • 6
  • 25
  • 47
Mattman85208
  • 1,858
  • 2
  • 29
  • 51
  • Hey Matthew, can you possibly provide the code which is throwing this error? The short answer is you can probably get around this by sanitising the date value and ensuring the microseconds is limited to 6 precision points, but it's hard to say why exactly it's happening considering the info you've provided. – Gerik Jun 22 '18 at 18:07
  • 1
    This appears to be a bug in pypyodbc related to `datetime2(7)` values, reported [here](https://github.com/jiangwen365/pypyodbc/issues/75). BTW, my pypyodbc [test code](https://pastebin.com/nqBMNxGr) also failed with the second (supposedly working) value that you supplied. Both values can be successfully retrieved using pyodbc. – Gord Thompson Jun 23 '18 at 20:27

0 Answers0