great_expectations.rule_based_profiler.expectation_configuration_builder
¶
Submodules¶
Package Contents¶
Classes¶
|
A Builder provides methods to serialize any builder object of a rule generically. |
|
Class which creates ExpectationConfiguration out of a given Expectation type and |
-
class
great_expectations.rule_based_profiler.expectation_configuration_builder.
ExpectationConfigurationBuilder
(expectation_type: str, **kwargs)¶ Bases:
great_expectations.rule_based_profiler.types.Builder
,abc.ABC
A Builder provides methods to serialize any builder object of a rule generically.
-
_expectation_type
¶ Since ExpectationConfigurationBuilderConfigSchema allow arbitrary fields (as ExpectationConfiguration kwargs) to be provided, they must be all converted to public property accessors and/or public fields in order for all provisions by Builder, SerializableDictDot, and DictDot to operate properly in compliance with their interfaces.
-
build_expectation_configuration
(self, domain: Domain, variables: Optional[ParameterContainer] = None, parameters: Optional[Dict[str, ParameterContainer]] = None)¶
-
abstract
_build_expectation_configuration
(self, domain: Domain, variables: Optional[ParameterContainer] = None, parameters: Optional[Dict[str, ParameterContainer]] = None)¶
-
property
expectation_type
(self)¶
-
-
class
great_expectations.rule_based_profiler.expectation_configuration_builder.
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 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
-