Fix for np.int8 error, refs #632

Also refs:
- https://github.com/simonw/llm/issues/531
This commit is contained in:
Simon Willison 2024-07-18 11:32:48 -07:00 committed by GitHub
commit dc79454234
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -206,21 +206,25 @@ COLUMN_TYPE_MAPPING = {
}
# 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: