great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder

Module Contents

Classes

DefaultExpectationConfigurationBuilder(expectation_type: str, condition: Optional[str] = None, meta: Optional[Dict[str, Any]] = None, **kwargs)

Class which creates ExpectationConfiguration out of a given Expectation type and

great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder.text
great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder.integer
great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder.var
great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder.comparison_operator
great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder.binary_operator
great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder.operand
great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder.expr
exception great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder.ExpectationConfigurationConditionParserError(message)

Bases: great_expectations.exceptions.GreatExpectationsError

Common base class for all non-exit exceptions.

class great_expectations.rule_based_profiler.expectation_configuration_builder.default_expectation_configuration_builder.DefaultExpectationConfigurationBuilder(expectation_type: str, condition: Optional[str] = None, meta: Optional[Dict[str, Any]] = None, **kwargs)

Bases: great_expectations.rule_based_profiler.expectation_configuration_builder.ExpectationConfigurationBuilder

Class which creates ExpectationConfiguration out of a given Expectation type and parameter_name-to-parameter_fully_qualified_parameter_name map (name-value pairs supplied in the kwargs dictionary).

ExpectationConfigurations can be optionally filtered if a supplied condition is met.

exclude_field_names :Set[str]
property expectation_type(self)
property condition(self)
property kwargs(self)
property meta(self)
_parse_condition(self)

Using the grammer defined by expr, provides the condition to the parser.

Applicability: To be used as part of configuration (e.g., YAML-based files or text strings). Extendability: Readily extensible to include “slice” and other standard accessors (as long as no dynamic elements).

_substitute_parameters_and_variables(self, term_list: Union[str, ParseResults], domain: Domain, variables: Optional[ParameterContainer] = None, parameters: Optional[Dict[str, ParameterContainer]] = None)

Recursively substitute all parameters and variables in term list

Given a list of terms created by parsing a provided condition, recursively substitute all parameters and variables in the term list, regardless of depth of groupings.

Example

condition: “($variables.max_user_id>0 & $variables.answer==42) | $parameter.my_min_user_id.value[0]<0” will return the following term list from self._parse_condition:

parsed_condition = [[
[

[‘$variables.max_user_id’, ‘>’, 0], ‘&’, [‘$variables.answer’, ‘==’, 42]

], ‘|’, [‘$parameter.my_min_user_id.value[0]’, ‘<’, 0]

]]

This method will then take that term list and recursively search for parameters and variables that need to be substituted and return this ParseResults object:

return [[
[

[999999999999, ‘>’, 0], ‘&’, [42, ‘==’, 42]

], ‘|’, [397433, ‘<’, 0]

]]

Parameters
  • term_list (Union[str, ParseResults) – the ParseResults object returned from self._parse_condition

  • domain (Domain) – The domain of the ExpectationConfiguration

  • variables (Optional[ParameterContainer]) – The variables set for this ExpectationConfiguration

  • parameters (Optional[Dict[str, ParameterContainer]]) – The parameters set for this ExpectationConfiguration

Returns

a ParseResults object identical to the one returned by self._parse_condition except with

substituted parameters and variables.

Return type

ParseResults

_build_binary_list(self, substituted_term_list: Union[str, ParseResults])

Recursively build binary list from substituted terms

Given a list of substituted terms created by parsing a provided condition and substituting parameters and variables, recursively build binary condition ParseResults object, regardless of depth of groupings.

Example

substituted_term_list = [[
[

[999999999999, ‘>’, 0], ‘&’, [42, ‘==’, 42]

], ‘|’, [397433, ‘<’, 0]

]]

This method will then take that term list and recursively evaluate the terms between the top-level binary conditions and return this ParseResults object:

return [True, ‘&’ True]

Parameters

substituted_term_list (Union[str, ParseResults]) – the ParseResults object returned from self._substitute_parameters_and_variables

Returns

a ParseResults object with all terms evaluated except for binary operations.

Return type

ParseResults

_build_boolean_result(self, binary_list: List[Union[bool, str]])

Recursively build boolean result from binary list

Given a list of binary terms created by parsing a provided condition, substituting parameters and variables, and building binary condition ParseResults object, recursively evaluate remaining conditions and return boolean result of condition.

Example

binary_list = [True, ‘&’ True]

This method will then take that term list and recursively evaluate the remaining and return a boolean result for the provided condition:

return True

Parameters

binary_list (List[Union[bool, str]]) – the ParseResults object returned from self._substitute_parameters_and_variables

Returns

a boolean representing the evaluation of the entire provided condition.

Return type

bool

_evaluate_condition(self, parsed_condition: ParseResults, domain: Domain, variables: Optional[ParameterContainer] = None, parameters: Optional[Dict[str, ParameterContainer]] = None)

Evaluates the parsed condition to True/False and returns the boolean result

_build_expectation_configuration(self, domain: Domain, variables: Optional[ParameterContainer] = None, parameters: Optional[Dict[str, ParameterContainer]] = None)

Returns either and ExpectationConfiguration object or None depending on evaluation of condition