dataframely.deserialize_collection#

dataframely.deserialize_collection(
data: str,
strict: bool = True,
) type[Collection] | None[source]#

Deserialize a collection from a JSON string.

This method allows to dynamically load a collection from its serialization, without having to know the collection to load in advance.

Parameters:
  • data – The JSON string created via Collection.serialize().

  • strict – Whether to raise an exception if the collection cannot be deserialized.

Returns:

The collection loaded from the JSON data.

Raises:

DeserializationError – If the collection can not be deserialized and strict=True.

Attention

The returned collection cannot be used to create instances of the collection as filters cannot be correctly recovered from the serialized format as of polars 1.31. Thus, you should only use static information from the returned collection.

Attention

This functionality is considered unstable. It may be changed at any time without it being considered a breaking change.

See also

Collection.serialize() for additional information on serialization.