[storm] Compressed Pickle and RawStrings
Jamu Kakar
jkakar at kakar.ca
Wed Apr 11 15:42:45 UTC 2012
Hi,
On Wed, Apr 11, 2012 at 6:35 AM, Barry Warsaw <barry at canonical.com> wrote:
>>On Wed, Apr 11, 2012 at 4:32 AM, Barry Warsaw <barry at canonical.com> wrote:
>>> accept_these_nonmembers = Pickle() # XXX
>
> Just a quick follow up about that XXX. In my own code, I consider Pickle()
> types a useful transitional technique, but it's not something I want to carry
> long term. It's very convenient, and helps us get from the "old" persistence
> mechanism to a Storm/SQL-based one, so I'm really glad it's there!
>
> In the long term though, it's better to refactor the Pickle() types out, and
> I've done that in most (but not all) cases. The problem isn't Storm-related;
> pickles are a Python-only representation so it means that other non-Python
> processes would have difficulty extracting that data.
There's also a JSON property that you may want to use instead of
Pickle. It's a bit more interoperable, but otherwise very similar to
Pickle. You need to store it in a TEXT column, not BYTEA or BLOB, and
it can only contain data that can be loaded and dumped with json.loads
and json.dumps. I haven't needed to rely on it for interoperability,
but I do like that I can read it when I run manual queries in the psql
shell. My decode-Pickle-in-my-head skills are a bit rusty. ;)
Thanks,
J.
More information about the storm
mailing list