Skip to main content
Version: 0.15.50

metric_provider.py

class 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.

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

  3. 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.

great_expectations.expectations.metrics.metric_provider.metric_partial(engine: Type[great_expectations.execution_engine.execution_engine.ExecutionEngine], partial_fn_type: Union[str, great_expectations.core.metric_function_types.MetricPartialFunctionTypes], domain_type: Union[str, great_expectations.core.metric_domain_types.MetricDomainTypes], **kwargs)#

Decorator used to register a specific function as a metric partial.

Metric partial functions are used by MetricProviders to support batching of requests for multiple metrics in an ExecutionEngine. Instead of returning the metric value immediately, they return a different function that the ExecutionEngine can execute locally on your data to obtain the metric value.

-Relevant Documentation Links -
Parameters
  • engine – the type of ExecutionEngine that this partial supports

  • partial_fn_type – the type of partial function

  • domain_type – the type of domain this metric function processes

Returns

Decorated function

great_expectations.expectations.metrics.metric_provider.metric_value(engine: Type[great_expectations.execution_engine.execution_engine.ExecutionEngine], metric_fn_type: Union[str, great_expectations.core.metric_function_types.MetricFunctionTypes] = MetricFunctionTypes.VALUE, **kwargs)#

Decorator used to register a specific function as a metric value function.

Metric value functions are used by MetricProviders to immediately return the value of the requested metric.

-Relevant Documentation Links -
Parameters
  • engine – the type of ExecutionEngine that this partial supports

  • metric_fn_type – the type of metric function. Usually the default value should be maintained.

Returns

Decorated function