-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating tables with custom datatypes #406
Comments
I had no idea this was possible! I guess SQLite will allow any text string as the column type, defaulting to |
Allowing custom strings in the db["dummy"].create({
"title": str,
"vector": "array",
}) I'm slightly nervous about that just because people might accidentally use this without realizig what they are doing - passing Alternatively, this could work: db["dummy"].create({
"title": str,
"vector": CustomColumnType("array")
}) This would play better with |
The When creating the table, you could then error, or at least warn, if someone wasn't setting a column on a |
Wondering if this actually relates to #402 ? I also wonder if this would be a sensible approach for eg registering |
I was wondering if you have any more thoughts on this? I have a tangible use case now: adding a "vector" column to a database to support semantic search using doc2vec embeddings (example; note that the |
See also: #612 |
Via https://stackoverflow.com/a/18622264/454773 I note the ability to register custom handlers for novel datatypes that can map into and out of things like sqlite
BLOB
s.From a quick look and a quick play, I didn't spot a way to do this in
sqlite_utils
?For example:
We can then add / retrieve records from the database where the datatype of the
vector
field is a custom registeredarray
type (which is to say, anumpy
array):It would be handy to be able to do this idiomatically in
sqlite_utils
.The text was updated successfully, but these errors were encountered: