{"html_url": "https://github.com/simonw/sqlite-utils/issues/11#issuecomment-466695695", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/11", "id": 466695695, "node_id": "MDEyOklzc3VlQ29tbWVudDQ2NjY5NTY5NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-02-23T21:10:35Z", "updated_at": "2019-02-23T21:10:35Z", "author_association": "OWNER", "body": "Need to test this both with and without `numpy` installed.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 413740684, "label": "Detect numpy types when creating tables"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/11#issuecomment-466695672", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/11", "id": 466695672, "node_id": "MDEyOklzc3VlQ29tbWVudDQ2NjY5NTY3Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-02-23T21:10:23Z", "updated_at": "2019-02-23T21:10:23Z", "author_association": "OWNER", "body": "Rough sketch:\r\n\r\n```\r\n+try:\r\n+ import numpy\r\n+except ImportError:\r\n+ numpy = None\r\n+\r\n Column = namedtuple(\r\n \"Column\", (\"cid\", \"name\", \"type\", \"notnull\", \"default_value\", \"is_pk\")\r\n )\r\n\r\n@@ -70,6 +79,22 @@ class Database:\r\n datetime.time: \"TEXT\",\r\n None.__class__: \"TEXT\",\r\n }\r\n+ # If numpy is available, add more types\r\n+ if numpy:\r\n+ col_type_mapping.update({\r\n+ numpy.int8: \"INTEGER\",\r\n+ numpy.int16: \"INTEGER\",\r\n+ numpy.int32: \"INTEGER\",\r\n+ numpy.int64: \"INTEGER\",\r\n+ numpy.uint8: \"INTEGER\",\r\n+ numpy.uint16: \"INTEGER\",\r\n+ numpy.uint32: \"INTEGER\",\r\n+ numpy.uint64: \"INTEGER\",\r\n+ numpy.float16: \"FLOAT\",\r\n+ numpy.float32: \"FLOAT\",\r\n+ numpy.float64: \"FLOAT\",\r\n+ numpy.float128: \"FLOAT\",\r\n+ })\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 413740684, "label": "Detect numpy types when creating tables"}, "performed_via_github_app": null}