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
I'm having an issue with blobs in the database. According to the documentation, this field type is mapped to Python str.
When looking at the code, this is done with .decode('utf-8'). However, in our database we have some raw images, which of course can't be decoded as utf-8.
When looking through the adapter code (emmett/orm/adapters.py 229: def parse), I saw an option blob_decode.
However, I can't seem to find where to set that option. Is this an argument to app.config.db or adapter_args?
I have monkey patched the emmett.orm.adapters.parse method to forcefully set blob_decode to False, but that's very hacky and I've already seen some selects where my patch is not applied.
Summary: how do I get raw bytes from my bytea/blob database fields?
The text was updated successfully, but these errors were encountered:
I'm having an issue with blobs in the database. According to the documentation, this field type is mapped to Python str.
![image](https://private-user-images.githubusercontent.com/2529002/247141295-3d01a5a3-960c-411c-bbed-a95610c7a484.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5Njc2OTIsIm5iZiI6MTczODk2NzM5MiwicGF0aCI6Ii8yNTI5MDAyLzI0NzE0MTI5NS0zZDAxYTVhMy05NjBjLTQxMWMtYmJlZC1hOTU2MTBjN2E0ODQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMjIyOTUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NTk0OTM3YWNkNzExZGNiYWRkZjIwMWRmYjZjNDhjNDRmMGUxMzIxNDczMTBkOGZjYTViNmIwYjZhMDViMDU3NiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.nCH3zptL2AcRFlRsxoqpqDjLCRPHr0bx7ny9z0q_TLI)
When looking at the code, this is done with
.decode('utf-8')
. However, in our database we have some raw images, which of course can't be decoded as utf-8.When looking through the adapter code (emmett/orm/adapters.py 229:
def parse
), I saw an optionblob_decode
.However, I can't seem to find where to set that option. Is this an argument to
app.config.db
oradapter_args
?I have monkey patched the
emmett.orm.adapters.parse
method to forcefully setblob_decode
to False, but that's very hacky and I've already seen some selects where my patch is not applied.Summary: how do I get raw bytes from my bytea/blob database fields?
The text was updated successfully, but these errors were encountered: