Skip to content

Commit

Permalink
Fix for np.int8 error, refs #632
Browse files Browse the repository at this point in the history
Also refs:
- simonw/llm#531
  • Loading branch information
simonw authored Jul 18, 2024
1 parent 577078f commit dc79454
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions sqlite_utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,25 @@ class Default:
}
# If numpy is available, add more types
if np:
COLUMN_TYPE_MAPPING.update(
{
np.int8: "INTEGER",
np.int16: "INTEGER",
np.int32: "INTEGER",
np.int64: "INTEGER",
np.uint8: "INTEGER",
np.uint16: "INTEGER",
np.uint32: "INTEGER",
np.uint64: "INTEGER",
np.float16: "FLOAT",
np.float32: "FLOAT",
np.float64: "FLOAT",
}
)
try:
COLUMN_TYPE_MAPPING.update(
{
np.int8: "INTEGER",
np.int16: "INTEGER",
np.int32: "INTEGER",
np.int64: "INTEGER",
np.uint8: "INTEGER",
np.uint16: "INTEGER",
np.uint32: "INTEGER",
np.uint64: "INTEGER",
np.float16: "FLOAT",
np.float32: "FLOAT",
np.float64: "FLOAT",
}
)
except AttributeError:
# https://github.com/simonw/sqlite-utils/issues/632
pass

# If pandas is available, add more types
if pd:
Expand Down

0 comments on commit dc79454

Please sign in to comment.