sqlutilpy 0.28.0__tar.gz → 0.29.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlutilpy
3
- Version: 0.28.0
3
+ Version: 0.29.0
4
4
  Summary: Database query code returning numpy arrays
5
5
  Author-email: "Sergey E. Koposov" <skoposov@ed.ac.uk>
6
6
  License: BSD
@@ -397,13 +397,15 @@ def __process_duckdb_column(col, intNullVal, strNullVal):
397
397
  if isinstance(col, np.ma.MaskedArray):
398
398
  kind = col.dtype.kind
399
399
  if kind in ('i', 'u') and intNullVal is not None:
400
- try:
401
- col = col.filled(intNullVal)
402
- except (TypeError, OverflowError):
400
+ info = np.iinfo(col.dtype)
401
+ if not (info.min <= intNullVal <= info.max):
403
402
  # intNullVal does not fit into the column type (e.g. a
404
403
  # negative value for an unsigned or a tinyint column),
405
- # so the column is widened to int64 first
406
- col = col.astype(np.int64).filled(intNullVal)
404
+ # so the column is widened to int64 first.
405
+ # (we check explicitly rather than catch an exception,
406
+ # because numpy<2 silently wraps the value instead)
407
+ col = col.astype(np.int64)
408
+ col = col.filled(intNullVal)
407
409
  elif kind == 'f':
408
410
  col = col.filled(np.nan)
409
411
  elif kind == 'M':
@@ -0,0 +1 @@
1
+ __version__ = '0.29.0'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlutilpy
3
- Version: 0.28.0
3
+ Version: 0.29.0
4
4
  Summary: Database query code returning numpy arrays
5
5
  Author-email: "Sergey E. Koposov" <skoposov@ed.ac.uk>
6
6
  License: BSD
@@ -1 +0,0 @@
1
- __version__ = '0.28.0'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes