Skip to main content

parser

Parsing functionaity for Transformation instances.

This module contains the transformations parser that will parse a set of Transformation specifications from a YAML file and create a set of Transformation instances.

Classes

TransformationsParser

class TransformationsParser():

A parser for converting YAML configs into Transformation instances.

info

To refer to a column, we can use c, col or column as a prefix followed by the column name.

To refer to a transformation, we can use t, tran or transformation as a prefix followed by the column name.

Methods


deserialize_transformations

def deserialize_transformations(    self, data: Iterable[Mapping[str, Mapping]],)> Tuple[List[Transformation], Set[str]]:

Deserializes a list of python objects into Transformation instances.

Arguments

  • data: The serialized data representing the list of Transformations.

Returns A tuple of the list of deserialized Transformation instances and any column names that are referenced.

Raises

  • TransformationParserError: If parsing errors occur. The errors are stored on the errors attribute of the exception.

parse

def parse(    self, yaml_str: str,)> Tuple[List[Transformation], Set[str]]:

Parses a transformations YAML config into a list of Transformation objects.

Arguments

  • yaml_str: The YAML config as a string.
  • Returns: A tuple of the list of Transformation instances and any column names that are referenced.

Raises

  • TransformationParserError: If parsing errors occur. The errors are stored on the errors attribute of the exception.

parse_file

def parse_file(    self, path: Union[str, os.PathLike],)> Tuple[List[Transformation], Set[str]]:

Parses a transformations YAML file into a list of Transformation objects.

Arguments

  • path: Path to the YAML config file.
  • Returns: A tuple of the list of Transformation instances and any column names that are referenced.

Raises

  • TransformationParserError: If parsing errors occur. The errors are stored on the errors attribute of the exception.