-
I'm working on storing my results in a SQL Server database. the result column is a VARBINARY(MAX) datatype. Is it possible to write a SQL Query to convert this data to readable text? I know how to use AsyncResult to get it in python. However, I want to be able to do get the result outside of python. An example result = 0x80049509000000000000008C056569646153942E Is this JSON? Is it base64 encoded? UTF-8? I notice all the entries start with 0x800495. Googling that doesn't yield any results. Just having a hard time knowing where to start. Just need someone to point me in the right direction. UPDATE: The hex example above is pickled data. my_string = '0x80049509000000000000008C056569646153942E'
pickled_data = bytes.fromhex(my_string[2:])
obj = pickle.loads(pickled_data)
print(obj) So, new questions - 1) Anyone know the TSQL equivalent to the this python code? 2) I know this is celery and not sqlalchemy, but does anyone know if there's a way to prevent sqlalchemy from pickling the result or use json instead of pickle before writing it to the database? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I faced the same problem using Postgres. It's actually coming from SQLAlchemy. There is a long going discussion on replacing the In the meantime, I personally ended up patching the |
Beta Was this translation helpful? Give feedback.
I faced the same problem using Postgres. It's actually coming from SQLAlchemy.
There is a long going discussion on replacing the
result
column type fromPickleType
to a plain binary field and have the serialization done on Celery's side using the configured result serializer, but it hasn't resolved yet.In the meantime, I personally ended up patching the
DatabaseBackend
(PickleType
->Text
) locally and plugged it as a custom backend.