David Zaslavsky on Nostr: Honestly, my recommendation would be JSON, if you hadn't ruled it out. If there are ...
Honestly, my recommendation would be JSON, if you hadn't ruled it out. If there are only a few values JSON can't handle, you could use a custom encoder and decoder.
Otherwise, maybe try pickle?
I wouldn't use sqlite to store a dict, unless it's guaranteed to be a single-level dict with string keys and basic data type values, and in that case what you have is more like a dataclass or named tuple anyway.
#Python
Published at
2024-06-16 07:50:49Event JSON
{
"id": "a6a1c3e2b6669e7c85aed62dd3164b7780c0ca38853e2888feffcea5155f0015",
"pubkey": "fdc7d6891dd1def2a5f2541999d3fc04ec1178f31e03e3d0a96a2ac4f2b303da",
"created_at": 1718524249,
"kind": 1,
"tags": [
[
"p",
"be57699118430b766b53fbefa9aa1bcafe2278b094580322145fe7175313c8d8"
],
[
"proxy",
"https://techhub.social/@diazona/112625205222145818",
"web"
],
[
"t",
"python"
],
[
"e",
"32d28ae8192e919b236d417437c510e1c28102af1c0063fbfdd682dbaefed0ce",
"",
"root"
],
[
"proxy",
"https://techhub.social/users/diazona/statuses/112625205222145818",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://techhub.social/users/diazona/statuses/112625205222145818",
"pink.momostr"
]
],
"content": "Honestly, my recommendation would be JSON, if you hadn't ruled it out. If there are only a few values JSON can't handle, you could use a custom encoder and decoder.\n\nOtherwise, maybe try pickle?\n\nI wouldn't use sqlite to store a dict, unless it's guaranteed to be a single-level dict with string keys and basic data type values, and in that case what you have is more like a dataclass or named tuple anyway.\n\n#Python",
"sig": "bc82f25ed74c7c07c24a1d7647af5fc83a8e926a2db39868a5bc87fb512ffb71f3a28358e5427236fcfa26271a7caf97a06367117f22257bba7663c00af1819e"
}