2.10.7

BQToPandasDecodingHandler

Package: flyteplugins.bigquery

Parameters

def BQToPandasDecodingHandler()

Extend this abstract class, implement the decode function, and register your concrete class with DataFrameTransformerEngine so that the Flyte type engine can handle dataframe libraries. This is the decoding interface: it is used when the Flyte type engine converts a Flyte Literal into a Python value. For the other direction, see DataFrameEncoder.

Properties

Property Type Description
protocol Optional[str]
python_type Type[DF]
supported_format str

Methods

Method Description
decode() This is code that will be called by the dataset transformer engine to ultimately translate from a Flyte Literal value into a Python instance.

decode()

def decode(
    flyte_value: flyteidl2.core.literals_pb2.StructuredDataset,
    current_task_metadata: flyteidl2.core.literals_pb2.StructuredDatasetMetadata,
) -> pd.DataFrame

This is code that will be called by the dataset transformer engine to ultimately translate from a Flyte Literal value into a Python instance.

Parameter Type Description
flyte_value flyteidl2.core.literals_pb2.StructuredDataset This will be a Flyte IDL DataFrame Literal - do not confuse this with the DataFrame class defined also in this module.
current_task_metadata flyteidl2.core.literals_pb2.StructuredDatasetMetadata Metadata object containing the type (and columns if any) for the currently executing task. This type may have more or less information than the type information bundled inside the incoming flyte_value.

Returns

This function can either return an instance of the dataframe that this decoder handles, or an iterator of those dataframes.