lakehouse_engine.io.reader
Defines abstract reader behaviour.
1"""Defines abstract reader behaviour.""" 2 3from abc import ABC, abstractmethod 4 5from pyspark.sql import DataFrame 6 7from lakehouse_engine.core.definitions import InputSpec 8from lakehouse_engine.utils.logging_handler import LoggingHandler 9 10 11class Reader(ABC): 12 """Abstract Reader class.""" 13 14 def __init__(self, input_spec: InputSpec): 15 """Construct Reader instances. 16 17 Args: 18 input_spec: input specification for reading data. 19 """ 20 self._logger = LoggingHandler(self.__class__.__name__).get_logger() 21 self._input_spec = input_spec 22 23 @abstractmethod 24 def read(self) -> DataFrame: 25 """Abstract read method. 26 27 Returns: 28 A dataframe read according to the input specification. 29 """ 30 raise NotImplementedError
class
Reader(abc.ABC):
12class Reader(ABC): 13 """Abstract Reader class.""" 14 15 def __init__(self, input_spec: InputSpec): 16 """Construct Reader instances. 17 18 Args: 19 input_spec: input specification for reading data. 20 """ 21 self._logger = LoggingHandler(self.__class__.__name__).get_logger() 22 self._input_spec = input_spec 23 24 @abstractmethod 25 def read(self) -> DataFrame: 26 """Abstract read method. 27 28 Returns: 29 A dataframe read according to the input specification. 30 """ 31 raise NotImplementedError
Abstract Reader class.
Reader(input_spec: lakehouse_engine.core.definitions.InputSpec)
15 def __init__(self, input_spec: InputSpec): 16 """Construct Reader instances. 17 18 Args: 19 input_spec: input specification for reading data. 20 """ 21 self._logger = LoggingHandler(self.__class__.__name__).get_logger() 22 self._input_spec = input_spec
Construct Reader instances.
Arguments:
- input_spec: input specification for reading data.
@abstractmethod
def
read(self) -> pyspark.sql.dataframe.DataFrame:
24 @abstractmethod 25 def read(self) -> DataFrame: 26 """Abstract read method. 27 28 Returns: 29 A dataframe read according to the input specification. 30 """ 31 raise NotImplementedError
Abstract read method.
Returns:
A dataframe read according to the input specification.