[FEATURE]: SQLite: Support blob
SQL type in relational queries
#2171
Labels
enhancement
New feature or request
blob
SQL type in relational queries
#2171
Describe what you want
This issue has been made a few times and the conclusion is store json in text not blob type. However, my use case is storing UUIDs in blob instead of text to cut down on storage. (Maybe there's perf gains for column comparisons too, who knows)
Proposed solution:
If the column is of blob type instead of sending an invalid query, wrap the field in
hex
and return it as a string then convert that back into aBuffer
in drizzle.The first part seems easy,
If this could be done better, let me know.
Git Diff
Converting this string back to a buffer seems less easy to me.
Maybe we can add:
To
SQLiteBlobBuffer
. And thenvalue.toString()
->typeof value === "string" ? value : value.toString()
in the other two blob classes.That just leaves custom column types:
Cons:
Extra overhead of converting hex strings to Buffer. This isn't done for BlobJSON or BlobBigInt but it is always done for custom blob columns and regular BlobBuffer even if the consumer then converts these to strings. So there's some compute wasted there.
Pros:
We can fetch blob type columns in relational queries!
Many thanks for reading ❤️
The text was updated successfully, but these errors were encountered: