Skip to main content
Version: 0.17.23

Add custom parameters to Custom Expectations

Using custom parameters in your Custom Expectations can help you create powerful, business-specific validations and help you optimize your Great Expectations (GX) workflows. Custom parameters should be implemented when you have data dependencies that can’t or shouldn’t be hardcoded. The method of implementing custom parameters is specific to the Custom Expectation class being extended.


All Custom Expectations include a success_keys attribute that is a tuple of strings. The tuple items are the names of the parameters which are available during the evaluation of your Custom Expectation. For example, the success_keys attribute for the ColumnPairMapExpectation appears similar to the following example:

success_keys = (

The tuple in the example includes the two columns being evaluated and the mostly parameter. These parameters are passed as a part of your ExpectationConfiguration and are available to the Expectation _validate method.

Use case

In this use case, a condition_value_keys tuple and a condition_domain_keys tuple are added to ColumnPairMapMetrics, MulticolumnMapMetrics, and ColumnMapMetrics. The condition_value_keys tuple supplies the arguments needed to compute your Metric, and the condition_domain_keys tuple defines the domain on which the Metric operates.

All parameters being passed to a Metric for use in value or domain keys must also be passed as success_keys in the Expectation class.

This is how the tuples appear in the MulticolumnMapMetrics Metric:

condition_domain_keys = (
condition_value_keys = ("sum_total",)

ColumnAggregateMetrics, TableMetrics, and QueryMetrics can similarly define a value_keys tuple or a domain_keys tuple:

value_keys = ("column",)
domain_keys = ("query",)

After the attributes are added to the Expectation and the Metric, the custom parameters can be passed into and used within the individual Metric functions. For example, this is how it appears in the ColumnValuesBetween Metric:

condition_metric_name = "column_values.between"
condition_value_keys = (
parse_strings_as_datetimes: bool = False,

To view the full code that you would use to pass custom parameters in a Custom Expectation, see

kwarg-based access

GX recommends using custom parameters to create validations and optimize workflows. However, you can also use kwarg syntax to define Metrics for your Expectations. An example kwarg implementation is provided in

To use kwarg syntax to define Metrics for your Expectations, you need to set the kwargs with a value_keys tuple first.

Default parameters

The following table lists the default parameters that are available for each Expectation class.

Expectation classDefault parameters
BatchExpectationSee BatchExpectation
ColumnAggregateExpectationSee ColumnAggregateExpectation
ColumnMapExpectationSee ColumnMapExpectation
RegexBasedColumnMapExpectationSee RegexBasedColumnMapExpectation
SetBasedColumnMapExpectationSee SetBasedColumnMapExpectation
ColumnPairMapExpectationSee ColumnPairMapExpectation
MulticolumnMapExpectationSee MulticolumnMapExpectation
QueryExpectationSee QueryExpectation