lakehouse_engine.io.readers.dataframe_reader

Module to define behaviour to read from dataframes.

 1"""Module to define behaviour to read from dataframes."""
 2
 3from pyspark.sql import DataFrame
 4
 5from lakehouse_engine.core.definitions import InputSpec
 6from lakehouse_engine.io.reader import Reader
 7
 8
 9class DataFrameReader(Reader):
10    """Class to read data from a dataframe."""
11
12    def __init__(self, input_spec: InputSpec):
13        """Construct DataFrameReader instances.
14
15        Args:
16            input_spec: input specification.
17        """
18        super().__init__(input_spec)
19
20    def read(self) -> DataFrame:
21        """Read data from a dataframe.
22
23        Returns:
24            A dataframe containing the data from a dataframe previously
25            computed.
26        """
27        return self._input_spec.df_name
class DataFrameReader(lakehouse_engine.io.reader.Reader):
10class DataFrameReader(Reader):
11    """Class to read data from a dataframe."""
12
13    def __init__(self, input_spec: InputSpec):
14        """Construct DataFrameReader instances.
15
16        Args:
17            input_spec: input specification.
18        """
19        super().__init__(input_spec)
20
21    def read(self) -> DataFrame:
22        """Read data from a dataframe.
23
24        Returns:
25            A dataframe containing the data from a dataframe previously
26            computed.
27        """
28        return self._input_spec.df_name

Class to read data from a dataframe.

DataFrameReader(input_spec: lakehouse_engine.core.definitions.InputSpec)
13    def __init__(self, input_spec: InputSpec):
14        """Construct DataFrameReader instances.
15
16        Args:
17            input_spec: input specification.
18        """
19        super().__init__(input_spec)

Construct DataFrameReader instances.

Arguments:
  • input_spec: input specification.
def read(self) -> pyspark.sql.dataframe.DataFrame:
21    def read(self) -> DataFrame:
22        """Read data from a dataframe.
23
24        Returns:
25            A dataframe containing the data from a dataframe previously
26            computed.
27        """
28        return self._input_spec.df_name

Read data from a dataframe.

Returns:

A dataframe containing the data from a dataframe previously computed.