great_expectations.expectations.metrics.map_metric

Module Contents

Classes

MapMetricProvider()

Base class for all metric providers.

ColumnMapMetricProvider()

Base class for all metric providers.

Functions

column_function_partial(engine: Type[ExecutionEngine], partial_fn_type: str = None, **kwargs)

Provides engine-specific support for authing a metric_fn with a simplified signature.

column_condition_partial(engine: Type[ExecutionEngine], partial_fn_type: Optional[Union[str, MetricPartialFunctionTypes]] = None, **kwargs)

Provides engine-specific support for authing a metric_fn with a simplified signature. A column_condition_partial

_pandas_map_condition_unexpected_count(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns unexpected count for MapExpectations

_pandas_column_map_condition_values(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Return values from the specified domain that match the map-style metric in the metrics dictionary.

_pandas_column_map_series_and_domain_values(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Return values from the specified domain that match the map-style metric in the metrics dictionary.

_pandas_map_condition_index(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

_pandas_column_map_condition_value_counts(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns respective value counts for distinct column values

_pandas_map_condition_rows(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Return values from the specified domain (ignoring the column constraint) that match the map-style metric in the metrics dictionary.

_sqlalchemy_map_condition_unexpected_count_aggregate_fn(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns unexpected count for MapExpectations

_sqlalchemy_map_condition_unexpected_count_value(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns unexpected count for MapExpectations. This is a value metric, which is useful for

_sqlalchemy_column_map_condition_values(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Particularly for the purpose of finding unexpected values, returns all the metric values which do not meet an

_sqlalchemy_column_map_condition_value_counts(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns value counts for all the metric values which do not meet an expected Expectation condition for instances

_sqlalchemy_map_condition_rows(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns all rows of the metric values which do not meet an expected Expectation condition for instances

_spark_map_condition_unexpected_count_aggregate_fn(cls, execution_engine: SparkDFExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

_spark_map_condition_unexpected_count_value(cls, execution_engine: SparkDFExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

spark_column_map_condition_values(cls, execution_engine: SparkDFExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

_spark_column_map_condition_value_counts(cls, execution_engine: SparkDFExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

_spark_map_condition_rows(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

great_expectations.expectations.metrics.map_metric.logger
great_expectations.expectations.metrics.map_metric.column_function_partial(engine: Type[ExecutionEngine], partial_fn_type: str = None, **kwargs)

Provides engine-specific support for authing a metric_fn with a simplified signature.

A metric function that is decorated as a column_function_partial will be called with the engine-specific column type and any value_kwargs associated with the Metric for which the provider function is being declared.

Parameters
  • engine

  • **kwargs

Returns

An annotated metric_function which will be called with a simplified signature.

great_expectations.expectations.metrics.map_metric.column_condition_partial(engine: Type[ExecutionEngine], partial_fn_type: Optional[Union[str, MetricPartialFunctionTypes]] = None, **kwargs)

Provides engine-specific support for authing a metric_fn with a simplified signature. A column_condition_partial must provide a map function that evalues to a boolean value; it will be used to provide supplemental metrics, such as the unexpected_value count, unexpected_values, and unexpected_rows.

A metric function that is decorated as a column_condition_partial will be called with the engine-specific column type and any value_kwargs associated with the Metric for which the provider function is being declared.

Parameters
  • engine

  • **kwargs

Returns

An annotated metric_function which will be called with a simplified signature.

great_expectations.expectations.metrics.map_metric._pandas_map_condition_unexpected_count(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns unexpected count for MapExpectations

great_expectations.expectations.metrics.map_metric._pandas_column_map_condition_values(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Return values from the specified domain that match the map-style metric in the metrics dictionary.

great_expectations.expectations.metrics.map_metric._pandas_column_map_series_and_domain_values(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Return values from the specified domain that match the map-style metric in the metrics dictionary.

great_expectations.expectations.metrics.map_metric._pandas_map_condition_index(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)
great_expectations.expectations.metrics.map_metric._pandas_column_map_condition_value_counts(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns respective value counts for distinct column values

great_expectations.expectations.metrics.map_metric._pandas_map_condition_rows(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Return values from the specified domain (ignoring the column constraint) that match the map-style metric in the metrics dictionary.

great_expectations.expectations.metrics.map_metric._sqlalchemy_map_condition_unexpected_count_aggregate_fn(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns unexpected count for MapExpectations

great_expectations.expectations.metrics.map_metric._sqlalchemy_map_condition_unexpected_count_value(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns unexpected count for MapExpectations. This is a value metric, which is useful for when the unexpected_condition is a window function.

great_expectations.expectations.metrics.map_metric._sqlalchemy_column_map_condition_values(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Particularly for the purpose of finding unexpected values, returns all the metric values which do not meet an expected Expectation condition for ColumnMapExpectation Expectations.

great_expectations.expectations.metrics.map_metric._sqlalchemy_column_map_condition_value_counts(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns value counts for all the metric values which do not meet an expected Expectation condition for instances of ColumnMapExpectation.

great_expectations.expectations.metrics.map_metric._sqlalchemy_map_condition_rows(cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)

Returns all rows of the metric values which do not meet an expected Expectation condition for instances of ColumnMapExpectation.

great_expectations.expectations.metrics.map_metric._spark_map_condition_unexpected_count_aggregate_fn(cls, execution_engine: SparkDFExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)
great_expectations.expectations.metrics.map_metric._spark_map_condition_unexpected_count_value(cls, execution_engine: SparkDFExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)
great_expectations.expectations.metrics.map_metric.spark_column_map_condition_values(cls, execution_engine: SparkDFExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)
great_expectations.expectations.metrics.map_metric._spark_column_map_condition_value_counts(cls, execution_engine: SparkDFExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)
great_expectations.expectations.metrics.map_metric._spark_map_condition_rows(cls, execution_engine: PandasExecutionEngine, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, metrics: Dict[str, Any], **kwargs)
class great_expectations.expectations.metrics.map_metric.MapMetricProvider

Bases: great_expectations.expectations.metrics.metric_provider.MetricProvider

Base class for all metric providers.

MetricProvider classes must have the following attributes set:
  1. metric_name: the name to use. Metric Name must be globally unique in a great_expectations installation.

  1. domain_keys: a tuple of the keys used to determine the domain of the metric

  2. value_keys: a tuple of the keys used to determine the value of the metric.

In some cases, subclasses of Expectation, such as TableMetricProvider will already have correct values that may simply be inherited.

They may optionally override the default_kwarg_values attribute.

MetricProvider classes must implement the following:

1. _get_evaluation_dependencies. Note that often, _get_evaluation_dependencies should augment dependencies provided by a parent class; consider calling super()._get_evaluation_dependencies

In some cases, subclasses of Expectation, such as MapMetricProvider will already have correct implementations that may simply be inherited.

Additionally, they may provide implementations of:

1. Data Docs rendering methods decorated with the @renderer decorator. See the guide “How to create renderers for custom expectations” for more information.

condition_domain_keys = ['batch_id', 'table', 'row_condition', 'condition_parser']
function_domain_keys = ['batch_id', 'table', 'row_condition', 'condition_parser']
condition_value_keys
function_value_keys
filter_column_isnull = True
classmethod _register_metric_functions(cls)
classmethod _get_evaluation_dependencies(cls, metric: MetricConfiguration, configuration: Optional[ExpectationConfiguration] = None, execution_engine: Optional[ExecutionEngine] = None, runtime_configuration: Optional[dict] = None)
class great_expectations.expectations.metrics.map_metric.ColumnMapMetricProvider

Bases: great_expectations.expectations.metrics.map_metric.MapMetricProvider

Base class for all metric providers.

MetricProvider classes must have the following attributes set:
  1. metric_name: the name to use. Metric Name must be globally unique in a great_expectations installation.

  1. domain_keys: a tuple of the keys used to determine the domain of the metric

  2. value_keys: a tuple of the keys used to determine the value of the metric.

In some cases, subclasses of Expectation, such as TableMetricProvider will already have correct values that may simply be inherited.

They may optionally override the default_kwarg_values attribute.

MetricProvider classes must implement the following:

1. _get_evaluation_dependencies. Note that often, _get_evaluation_dependencies should augment dependencies provided by a parent class; consider calling super()._get_evaluation_dependencies

In some cases, subclasses of Expectation, such as MapMetricProvider will already have correct implementations that may simply be inherited.

Additionally, they may provide implementations of:

1. Data Docs rendering methods decorated with the @renderer decorator. See the guide “How to create renderers for custom expectations” for more information.

condition_domain_keys = ['batch_id', 'table', 'column', 'row_condition', 'condition_parser']
function_domain_keys = ['batch_id', 'table', 'column', 'row_condition', 'condition_parser']
condition_value_keys
function_value_keys
classmethod _get_evaluation_dependencies(cls, metric: MetricConfiguration, configuration: Optional[ExpectationConfiguration] = None, execution_engine: Optional[ExecutionEngine] = None, runtime_configuration: Optional[dict] = None)