diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index 6332dc2..6b3de87 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -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: