Julia analogue of Python `shelve` module?

Do we have something similar to:

12.3. shelve — Python object persistence

Warning: Because the shelve module is backed by pickle, it is insecure to load a shelf from an untrusted source. Like with pickle, loading a shelf can execute arbitrary code.

I know we have similar to pickle, i.e. for serialization (with the same pros and cons), not a full “persistent dictionary” like this.

We do have many ORM-packages, for relational databases, and maybe this is relevant:

“Strapping” stands for ST ruct R elational M APPING, and provides ORM-like functionality for Julia, including:
[…]

  • transform any Julia struct (or vector of structs) into a 2D Tables.jl-compatible source, which can be stored in a database, file format, or other “sink” (see ?Strapping.deconstruct )

Is this what you’re looking for?

Yes! I actually thought of .jld and .jld2 files (and the packages for them) for serializing and deserializing, comparable to Python’s pickle. But actually they’re more comparable to shelve, while shelve uses dbm files. [Such files don’t seem inherently better, while I guess simpler.]

Julia can serialize and deserialize, similar to Python’s pickle, while pickle is cross-platform, Julia’s isn’t nor cross-version: “deserialize assumes the binary data read from stream is correct and has been serialized by a compatible implementation of serialize.” I think pickle neither supports random access, and that’s what shelve is for and the .jld and other types of files. Other options would be e.g. Arrow format, not specific to Julia, while I think none of the cross-language formats support all arbitrary Julia types.