# Result Serializers
# Serializer
Serializers are used by Results to handle the transformation of Python objects to and from bytes.
Subclasses should implement serialize
and deserialize
.
methods: |
---|
prefect.engine.serializers.Serializer.deserialize (value)[source] |
Deserialize an object from bytes.
|
prefect.engine.serializers.Serializer.serialize (value)[source] |
Serialize an object to bytes.
|
# PickleSerializer
A Serializer
that uses cloudpickle to serialize Python objects.
methods: |
---|
prefect.engine.serializers.PickleSerializer.deserialize (value)[source] |
Deserialize an object from bytes using cloudpickle.
|
prefect.engine.serializers.PickleSerializer.serialize (value)[source] |
Serialize an object to bytes using cloudpickle.
|
# JSONSerializer
A Serializer that uses JSON to serialize objects
methods: |
---|
prefect.engine.serializers.JSONSerializer.deserialize (value)[source] |
Deserialize an object from JSON
|
prefect.engine.serializers.JSONSerializer.serialize (value)[source] |
Serialize an object to JSON
|
# DateTimeSerializer
A Serializer for working with human-readable datetimes
methods: |
---|
prefect.engine.serializers.DateTimeSerializer.deserialize (value)[source] |
Deserialize an datetime from human-readable bytes
|
prefect.engine.serializers.DateTimeSerializer.serialize (value)[source] |
Serialize a datetime to human-readable bytes
|
# PandasSerializer
class
prefect.engine.serializers.PandasSerializer
(file_type, deserialize_kwargs=None, serialize_kwargs=None)[source]A Serializer for Pandas DataFrames.
Args:
file_type (str)
: The type you want the resulting file to be saved as, e.g. "csv" or "parquet". Must match a type used in aDataFrame.to_
method and apd.read_
function.deserialize_kwargs (dict, optional)
: Keyword arguments to pass to the serialization method.serialize_kwargs (dict, optional)
: Keyword arguments to pass to the deserialization method.
methods: |
---|
prefect.engine.serializers.PandasSerializer.deserialize (value)[source] |
Deserialize an object to a Pandas DataFrame
|
prefect.engine.serializers.PandasSerializer.serialize (value)[source] |
Serialize a Pandas DataFrame to bytes.
|
# CompressedSerializer
class
prefect.engine.serializers.CompressedSerializer
(serializer, format=None, compress=None, decompress=None, compress_kwargs=None, decompress_kwargs=None)[source]A Serializer that wraps another Serializer and a compression function to serialize Python objects with compression.
Args:
serializer (Serializer)
: the serializer that this serializer wrapsformat (str)
: name of the compression format library. Typically one of the python standard compression libraries: bz2, gzip, lzma, or zlib. Attempts to import the given format's module and retrieves the compress/decompress functions.compress (Callable[..., bytes])
: the custom compression functiondecompress (Callable[..., bytes])
: the custom decompression functioncompress_kwargs (Dict[str, Any])
: keyword arguments to be passed to the compression functiondecompress_kwargs (Dict[str, Any])
: keyword arguments to be passed to the decompression function
methods: |
---|
prefect.engine.serializers.CompressedSerializer.compression_from_lib (compression_format)[source] |
Attempt to pull a compression format from a library. Typically one of "lzma", "gzip", "zlib", "bz2"
|
prefect.engine.serializers.CompressedSerializer.deserialize (value)[source] |
Deserialize an object from compressed bytes.
|
prefect.engine.serializers.CompressedSerializer.serialize (value)[source] |
Serialize an object to compressed bytes.
|
This documentation was auto-generated from commit n/a
on July 1, 2021 at 18:35 UTC