oTree Forum >

Parsing 'vars' column of otree_participant table in db.sqlite3

#1 by Student

Hi,

I'm testing an oTree app locally and would like to view changes made to the DB while testing, instead of downloading a csv file from the app-specific links in the admin pages. 

If I open the db.sqlite3 file in a SQLite viewer, I can navigate to the otree_participant table and see the vars column. But it's encrypted or compressed or is some kind of object I can't view or parse for the moment. It looks something like this:

gAN9cQAoWBAAAABwcm9wb3NpdGlvbl9saXN0cQFdcQIoXXEDKE1AH0sAZV1xBChNECdNoA9lXXEFKE0QJ01wF2VdcQYoTaAPSwBlXXEHKE0QJ02gD2VdcQgoTRAnSwBlXXEJKE1wF0sAZV1xCihN0AdLAGVdcQsoTRAnTUAfZV1xDChKwOD//0sAZV1xDShK8Nj//0pg8P//ZV1xDihK8Nj//0pg8P//ZV1xDyhKMPj//0sAZV1xEChKYPD//0sAZV1xEShK8Nj//0rA4P//ZV1xEihK8Nj//0sAZV1xEyhKkOj//0sAZV1xFChK8Nj//0qQ6P//ZV1xFShKSPT//024C2VdcRYoSpDo//9NcBdlZVgHAAAAY2hvaWNlc3EXXXEYWAwAAAB0aGlyZENob2ljZXNxGV1xGlgFAAAAZ3JvdXBxG1gLAAAAZ2FpbnNfZmlyc3RxHFgVAAAAbnVrZXByYWN0aWNlc19sb3R0ZXJ5cR2JWAgAAABzZXJ2ZWRVcHEeY2NvbGxlY3Rpb25zCmRlZmF1bHRkaWN0CnEfY2J1aWx0aW5zCmRpY3QKcSCFcSFScSJYCwAAAGNob2ljZXNNYWRlcSNoH2gghXEkUnElWBQAAABpbmNvbnNpc3RlbnRfYW5zd2Vyc3EmSwBYBwAAAGFuc3dlcnNxJ2gfaCCFcShScSl1Lg==

What format is this in? How can I make a key-value dictionary out of the contents of an entry in row of the 'vars' column?

I'd appreciate any help with this. 

Thanks.

#2 by ChristianK

It looks like a python pickle object that has been serialized and stored in the db.
https://docs.python.org/3/library/pickle.html

You could try running pickle.loads(...) on the data. Note that it is probably a binary format.

Write a reply

Set forum username