You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 a Buffer in drizzle.
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:
Colonel-Sandvich
changed the title
[FEATURE]: SQLite: Support blob SQL type in relational query
[FEATURE]: SQLite: Support blob SQL type in relational queries
Apr 17, 2024
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: