great_expectations.expectations.core

Submodules

Package Contents

Classes

ExpectColumnDistinctValuesToBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Expect the set of distinct column values to be contained by a given set.

ExpectColumnDistinctValuesToContainSet(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectColumnDistinctValuesToEqualSet(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectColumnKlDivergenceToBeLessThan(configuration: Optional[ExpectationConfiguration] = None)

Expect the Kulback-Leibler (KL) divergence (relative entropy) of the specified column with respect to the partition object to be lower than the provided threshold.

ExpectColumnMaxToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the column max to be between an min and max value

ExpectColumnMeanToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the column mean to be between a minimum value and a maximum value (inclusive).

ExpectColumnMedianToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the column median to be between a minimum value and a maximum value.

ExpectColumnMinToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the column minimum to be between an min and max value

ExpectColumnMostCommonValueToBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Expect the most common value to be within the designated value set

ExpectColumnPairCramersPhiValueToBeLessThan(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectColumnPairValuesAToBeGreaterThanB(configuration: Optional[ExpectationConfiguration] = None)

Expect values in column A to be greater than column B.

ExpectColumnPairValuesToBeEqual(configuration: Optional[ExpectationConfiguration] = None)

Expect the values in column A to be the same as column B.

ExpectColumnPairValuesToBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Expect paired values from columns A and B to belong to a set of valid pairs.

ExpectColumnProportionOfUniqueValuesToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the proportion of unique values to be between a minimum value and a maximum value.

ExpectColumnQuantileValuesToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect specific provided column quantiles to be between provided minimum and maximum values.

ExpectColumnStdevToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the column standard deviation to be between a minimum value and a maximum value.

ExpectColumnSumToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the column to sum to be between an min and max value

ExpectColumnToExist(configuration: Optional[ExpectationConfiguration] = None)

Expect the specified column to exist.

ExpectColumnUniqueValueCountToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the number of unique values to be between a minimum value and a maximum value.

ExpectColumnValueLengthsToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to be strings with length between a minimum value and a maximum value (inclusive).

ExpectColumnValueLengthsToEqual(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to be strings with length equal to the provided value.

ExpectColumnValueZScoresToBeLessThan(configuration: Optional[ExpectationConfiguration] = None)

Expect the Z-scores of a columns values to be less than a given threshold

ExpectColumnValuesToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to be between a minimum value and a maximum value (inclusive).

ExpectColumnValuesToBeDateutilParseable(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to be parsable using dateutil.

ExpectColumnValuesToBeDecreasing(configuration: Optional[ExpectationConfiguration] = None)

Expect column values to be decreasing.

ExpectColumnValuesToBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Expect each column value to be in a given set.

ExpectColumnValuesToBeInTypeList(configuration: Optional[ExpectationConfiguration] = None)

Expect a column to contain values from a specified type list.

ExpectColumnValuesToBeIncreasing(configuration: Optional[ExpectationConfiguration] = None)

Expect column values to be increasing.

ExpectColumnValuesToBeJsonParseable(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to be data written in JavaScript Object Notation.

ExpectColumnValuesToBeNull(configuration: Optional[ExpectationConfiguration] = None)

Expect column values to be null.

ExpectColumnValuesToBeOfType(configuration: Optional[ExpectationConfiguration] = None)

Expect a column to contain values of a specified data type.

ExpectColumnValuesToBeUnique(configuration: Optional[ExpectationConfiguration] = None)

Expect each column value to be unique.

ExpectColumnValuesToMatchJsonSchema(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to be JSON objects matching a given JSON schema.

ExpectColumnValuesToMatchLikePattern(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectColumnValuesToMatchLikePatternList(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectColumnValuesToMatchRegex(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to be strings that match a given regular expression.

ExpectColumnValuesToMatchRegexList(configuration: Optional[ExpectationConfiguration] = None)

Expect the column entries to be strings that can be matched to either any of or all of a list of regular

ExpectColumnValuesToMatchStrftimeFormat(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to be strings representing a date or time with a given format.

ExpectColumnValuesToNotBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to not be in the set.

ExpectColumnValuesToNotBeNull(configuration: Optional[ExpectationConfiguration] = None)

Expect column values to not be null.

ExpectColumnValuesToNotMatchLikePattern(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectColumnValuesToNotMatchLikePatternList(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectColumnValuesToNotMatchRegex(configuration: Optional[ExpectationConfiguration] = None)

Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, “[at]+” would identify the following strings as expected: “fish”, “dog”, and the following as unexpected: “cat”, “hat”.

ExpectColumnValuesToNotMatchRegexList(configuration: Optional[ExpectationConfiguration] = None)

Expect the column entries to be strings that do not match any of a list of regular expressions. Matches can

ExpectCompoundColumnsToBeUnique(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectMulticolumnValuesToBeUnique(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectSelectColumnValuesToBeUniqueWithinRecord(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectTableColumnCountToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the number of columns to be between two values.

ExpectTableColumnCountToEqual(configuration: Optional[ExpectationConfiguration] = None)

Expect the number of columns to equal a value.

ExpectTableColumnsToMatchOrderedList(configuration: Optional[ExpectationConfiguration] = None)

Expect the columns to exactly match a specified list.

ExpectTableColumnsToMatchSet(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

ExpectTableRowCountToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Expect the number of rows to be between two values.

ExpectTableRowCountToEqual(configuration: Optional[ExpectationConfiguration] = None)

Expect the number of rows to equal a value.

ExpectTableRowCountToEqualOtherTable(configuration: Optional[ExpectationConfiguration] = None)

Base class for all Expectations.

class great_expectations.expectations.core.ExpectColumnDistinctValuesToBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the set of distinct column values to be contained by a given set.

The success value for this expectation will match that of expect_column_values_to_be_in_set. However, expect_column_distinct_values_to_be_in_set is a column_aggregate_expectation.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_distinct_values_to_be_in_set(
    "my_col",
    [2, 3, 4]
)
{
  "success": false
  "result": {
    "observed_value": [1,2,3],
    "details": {
      "value_counts": [
        {
          "value": 1,
          "count": 1
        },
        {
          "value": 2,
          "count": 1
        },
        {
          "value": 3,
          "count": 1
        }
      ]
    }
  }
}
Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments

parse_strings_as_datetimes (boolean or None) – If True values provided in value_set will be parsed as datetimes before making comparisons.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_distinct_values_to_contain_set

metric_dependencies = ['column.value_counts']
success_keys = ['value_set', 'parse_strings_as_datetimes']
default_kwarg_values
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_value_counts_bar_chart_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validating that user has inputted a value set and that configuration has been initialized

_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnDistinctValuesToContainSet(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

metric_dependencies = ['column.value_counts']
success_keys = ['value_set', 'parse_strings_as_datetimes']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validating that user has inputted a value set and that configuration has been initialized

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnDistinctValuesToEqualSet(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

metric_dependencies = ['column.value_counts']
success_keys = ['value_set', 'parse_strings_as_datetimes']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validating that user has inputted a value set and that configuration has been initialized

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnKlDivergenceToBeLessThan(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Expect the Kulback-Leibler (KL) divergence (relative entropy) of the specified column with respect to the partition object to be lower than the provided threshold.

KL divergence compares two distributions. The higher the divergence value (relative entropy), the larger the difference between the two distributions. A relative entropy of zero indicates that the data are distributed identically, when binned according to the provided partition.

In many practical contexts, choosing a value between 0.5 and 1 will provide a useful test.

This expectation works on both categorical and continuous partitions. See notes below for details.

expect_column_kl_divergence_to_be_less_than is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • partition_object (dict) – The expected partition object (see Partition Objects).

  • threshold (float) – The maximum KL divergence to for which to return success=True. If KL divergence is larger than the provided threshold, the test will return success=False.

Keyword Arguments
  • internal_weight_holdout (float between 0 and 1 or None) – The amount of weight to split uniformly among zero-weighted partition bins. internal_weight_holdout provides a mechanisms to make the test less strict by assigning positive weights to values observed in the data for which the partition explicitly expected zero weight. With no internal_weight_holdout, any value observed in such a region will cause KL divergence to rise to +Infinity. Defaults to 0.

  • tail_weight_holdout (float between 0 and 1 or None) – The amount of weight to add to the tails of the histogram. Tail weight holdout is split evenly between (-Infinity, min(partition_object[‘bins’])) and (max(partition_object[‘bins’]), +Infinity). tail_weight_holdout provides a mechanism to make the test less strict by assigning positive weights to values observed in the data that are not present in the partition. With no tail_weight_holdout, any value observed outside the provided partition_object will cause KL divergence to rise to +Infinity. Defaults to 0.

  • bucketize_data (boolean) – If True, then continuous data will be bucketized before evaluation. Setting this parameter to false allows evaluation of KL divergence with a None partition object for profiling against discrete data.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
  "observed_value": (float) The true KL divergence (relative entropy) or None if the value is                       calculated as infinity, -infinity, or NaN
  "details": {
    "observed_partition": (dict) The partition observed in the data
    "expected_partition": (dict) The partition against which the data were compared,
                            after applying specified weight holdouts.
  }
}

If the partition_object is categorical, this expectation will expect the values in column to also be categorical.

  • If the column includes values that are not present in the partition, the tail_weight_holdout

will be equally split among those values, providing a mechanism to weaken the strictness of the expectation (otherwise, relative entropy would immediately go to infinity). * If the partition includes values that are not present in the column, the test will simply include zero weight for that value.

If the partition_object is continuous, this expectation will discretize the values in the column according to the bins specified in the partition_object, and apply the test to the resulting distribution.

  • The internal_weight_holdout and tail_weight_holdout parameters provide a mechanism to weaken the expectation, since an expected weight of zero would drive relative entropy to be infinite if any

data are observed in that interval. * If internal_weight_holdout is specified, that value will be distributed equally among any intervals with weight zero in the partition_object. * If tail_weight_holdout is specified, that value will be appended to the tails of the bins ((-Infinity, min(bins)) and (max(bins), Infinity).

If relative entropy/kl divergence goes to infinity for any of the reasons mentioned above, the observed value will be set to None. This is because inf, -inf, Nan, are not json serializable and cause some json parsers to crash when encountered. The python None token will be serialized to null in json.

success_keys = ['partition_object', 'threshold', 'tail_weight_holdout', 'internal_weight_holdout', 'bucketize_data']
default_kwarg_values
get_validation_dependencies(self, configuration: Optional[ExpectationConfiguration] = None, execution_engine: Optional[ExecutionEngine] = None, runtime_configuration: Optional[dict] = None)

Returns the result format and metrics required to validate this Expectation using the provided result format.

_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
classmethod _get_kl_divergence_chart(cls, partition_object, header=None)
classmethod _get_kl_divergence_partition_object_table(cls, partition_object, header=None)
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _diagnostic_observed_value_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_histogram_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnMaxToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the column max to be between an min and max value

expect_column_max_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name

  • min_value (comparable type or None) – The minimum number of unique values allowed.

  • max_value (comparable type or None) – The maximum number of unique values allowed.

Keyword Arguments
  • parse_strings_as_datetimes (Boolean or None) – If True, parse min_value, max_values, and all non-null column values to datetimes before making comparisons.

  • output_strftime_format (str or None) – A valid strfime format for datetime output. Only used if parse_strings_as_datetimes=True.

  • strict_min (boolean) – If True, the minimal column minimum must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the maximal column minimum must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (list) The actual column max
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

metric_dependencies = ['column.max']
success_keys = ['min_value', 'strict_min', 'max_value', 'strict_max']
default_kwarg_values

A Column Map MetricProvider Decorator for the Maximum

validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_stats_table_max_row_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnMeanToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the column mean to be between a minimum value and a maximum value (inclusive).

expect_column_mean_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (float or None) – The minimum value for the column mean.

  • max_value (float or None) – The maximum value for the column mean.

  • strict_min (boolean) – If True, the column mean must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the column mean must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The true mean for the column
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound.

  • If max_value is None, then min_value is treated as a lower bound.

See also

expect_column_median_to_be_between

expect_column_stdev_to_be_between

metric_dependencies = ['column.mean']
success_keys = ['min_value', 'strict_min', 'max_value', 'strict_max']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_stats_table_mean_row_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnMedianToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the column median to be between a minimum value and a maximum value.

expect_column_median_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (int or None) – The minimum value for the column median.

  • max_value (int or None) – The maximum value for the column median.

  • strict_min (boolean) – If True, the column median must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the column median must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The true median for the column
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

See also

expect_column_mean_to_be_between

expect_column_stdev_to_be_between

metric_dependencies = ['column.median']
success_keys = ['min_value', 'strict_min', 'max_value', 'strict_max']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnMinToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the column minimum to be between an min and max value

expect_column_min_to_be_between is a :func:`column_aggregate_expectation

<great_expectations.execution_engine.MetaExecutionEngine.column_aggregate_expectation>`.

Parameters
  • column (str) – The column name

  • min_value (comparable type or None) – The minimal column minimum allowed.

  • max_value (comparable type or None) – The maximal column minimum allowed.

  • strict_min (boolean) – If True, the minimal column minimum must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the maximal column minimum must be strictly smaller than max_value, default=False

Keyword Arguments
  • parse_strings_as_datetimes (Boolean or None) – If True, parse min_value, max_values, and all non-null column values to datetimes before making comparisons.

  • output_strftime_format (str or None) – A valid strfime format for datetime output. Only used if parse_strings_as_datetimes=True.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (list) The actual column min
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

metric_dependencies = ['column.min']
success_keys = ['min_value', 'strict_min', 'max_value', 'strict_max']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_stats_table_min_row_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnMostCommonValueToBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the most common value to be within the designated value set

expect_column_most_common_value_to_be_in_set is a column_aggregate_expectation.

Parameters
  • column (str) – The column name

  • value_set (set-like) – A list of potential values to match

Keyword Arguments

ties_okay (boolean or None) – If True, then the expectation will still succeed if values outside the designated set are as common (but not more common) than designated values

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (list) The most common values in the column
}

observed_value contains a list of the most common values. Often, this will just be a single element. But if there’s a tie for most common among multiple values, observed_value will contain a single copy of each most common value.

metric_dependencies = ['column.most_common_value']
success_keys = ['value_set', 'ties_okay']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validating that user has inputted a value set and that configuration has been initialized

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnPairCramersPhiValueToBeLessThan(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

metric_dependencies
success_keys = ['column_A', 'column_B', 'threshold']
default_kwarg_values
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _diagnostic_observed_value_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnPairValuesAToBeGreaterThanB(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Expect values in column A to be greater than column B.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

  • or_equal (boolean or None) – If True, then values can be equal, not strictly greater

Keyword Arguments
  • allow_cross_type_comparisons (boolean or None) – If True, allow comparisons between types (e.g. integer and string). Otherwise, attempting such comparisons will raise an exception.

  • ignore_row_if (str) – “both_values_are_missing”, “either_value_is_missing”, “neither

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

metric_dependencies = ['column_a_greater_than_b']
success_keys = ['column_A', 'column_B', 'ignore_row_if', 'parse_strings_as_datetimes', 'allow_cross_type_comparisons', 'or_equal']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnPairValuesToBeEqual(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Expect the values in column A to be the same as column B.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

Keyword Arguments

ignore_row_if (str) – “both_values_are_missing”, “either_value_is_missing”, “neither”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

metric_dependencies = ['equal_columns']
success_keys = ['column_A', 'column_B', 'ignore_row_if']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnPairValuesToBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnPairMapExpectation

Expect paired values from columns A and B to belong to a set of valid pairs.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

  • value_pairs_set (list of tuples) – All the valid pairs to be matched

Keyword Arguments

ignore_row_if (str) – “both_values_are_missing”, “either_value_is_missing”, “never”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

map_metric = ['column_pair_values.in_set']
domain_keys = ['batch_id', 'table', 'row_condition', 'condition_parser', 'column_A', 'column_B']
success_keys = ['value_pairs_set', 'ignore_row_if', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnProportionOfUniqueValuesToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the proportion of unique values to be between a minimum value and a maximum value.

For example, in a column containing [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], there are 4 unique values and 10 total values for a proportion of 0.4.

expect_column_proportion_of_unique_values_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (float or None) – The minimum proportion of unique values. (Proportions are on the range 0 to 1)

  • max_value (float or None) – The maximum proportion of unique values. (Proportions are on the range 0 to 1)

  • strict_min (boolean) – If True, the minimum proportion of unique values must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the maximum proportion of unique values must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The proportion of unique values in the column
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

See also

expect_column_unique_value_count_to_be_between

metric_dependencies = ['column.unique_proportion']
success_keys = ['min_value', 'strict_min', 'max_value', 'strict_max']
default_kwarg_values

A Column Aggregate MetricProvider Decorator for the Unique Proportion

validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_column_properties_table_distinct_percent_row_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnQuantileValuesToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect specific provided column quantiles to be between provided minimum and maximum values.

quantile_ranges must be a dictionary with two keys:

  • quantiles: (list of float) increasing ordered list of desired quantile values

  • value_ranges: (list of lists): Each element in this list consists of a list with two values, a lower and upper bound (inclusive) for the corresponding quantile.

For each provided range:

  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound only

  • If max_value is None, then min_value is treated as a lower bound only

The length of the quantiles list and quantile_values list must be equal.

For example:

# my_df.my_col = [1,2,2,3,3,3,4]
>>> my_df.expect_column_quantile_values_to_be_between(
    "my_col",
    {
        "quantiles": [0., 0.333, 0.6667, 1.],
        "value_ranges": [[0,1], [2,3], [3,4], [4,5]]
    }
)
{
  "success": True,
    "result": {
      "observed_value": {
        "quantiles: [0., 0.333, 0.6667, 1.],
        "values": [1, 2, 3, 4],
      }
      "element_count": 7,
      "missing_count": 0,
      "missing_percent": 0.0,
      "details": {
        "success_details": [true, true, true, true]
      }
    }
  }
}

expect_column_quantile_values_to_be_between can be computationally intensive for large datasets.

expect_column_quantile_values_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • quantile_ranges (dictionary) – Quantiles and associated value ranges for the column. See above for details.

  • allow_relative_error (boolean) – Whether to allow relative error in quantile communications on backends that support or require it.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation: :: details.success_details

See also

expect_column_min_to_be_between

expect_column_max_to_be_between

expect_column_median_to_be_between

metric_dependencies = ['column.quantile_values']
success_keys = ['quantile_ranges', 'allow_relative_error']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _diagnostic_observed_value_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_quantile_table_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
get_validation_dependencies(self, configuration: Optional[ExpectationConfiguration] = None, execution_engine: Optional[ExecutionEngine] = None, runtime_configuration: Optional[dict] = None)

Returns the result format and metrics required to validate this Expectation using the provided result format.

_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnStdevToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the column standard deviation to be between a minimum value and a maximum value. Uses sample standard deviation (normalized by N-1).

expect_column_stdev_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (float or None) – The minimum value for the column standard deviation.

  • max_value (float or None) – The maximum value for the column standard deviation.

  • strict_min (boolean) – If True, the column standard deviation must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the column standard deviation must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The true standard deviation for the column
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

See also

expect_column_mean_to_be_between

expect_column_median_to_be_between

metric_dependencies = ['column.standard_deviation']
success_keys = ['min_value', 'strict_min', 'max_value', 'strict_max']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnSumToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the column to sum to be between an min and max value

expect_column_sum_to_be_between is a :func:`column_aggregate_expectation

<great_expectations.execution_engine.MetaExecutionEngine.column_aggregate_expectation>`.

Args:

column (str): The column name min_value (comparable type or None): The minimal sum allowed. max_value (comparable type or None): The maximal sum allowed. strict_min (boolean):

If True, the minimal sum must be strictly larger than min_value, default=False

strict_max (boolean):

If True, the maximal sum must be strictly smaller than max_value, default=False

Other Parameters:
result_format (str or None): Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY.

For more detail, see result_format.

include_config (boolean): If True, then include the expectation config as part of the result object. For more detail, see include_config. catch_exceptions (boolean or None): If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions. meta (dict or None): A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns:

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes:

These fields in the result object are customized for this expectation:

{
    "observed_value": (list) The actual column sum
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

metric_dependencies = ['column.sum']
success_keys = ['min_value', 'strict_min', 'max_value', 'strict_max']
default_kwarg_values

A Column Map Metric Decorator for the Sum

validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnToExist(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Expect the specified column to exist.

expect_column_to_exist is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters

column (str) – The column name.

Other Parameters
  • column_index (int or None) – If not None, checks the order of the columns. The expectation will fail if the column is not in location column_index (zero-indexed).

  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

metric_dependencies = ['table.columns']
success_keys = ['column', 'column_index']
domain_keys = ['batch_id', 'table']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnUniqueValueCountToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnExpectation

Expect the number of unique values to be between a minimum value and a maximum value.

expect_column_unique_value_count_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (int or None) – The minimum number of unique values allowed.

  • max_value (int or None) – The maximum number of unique values allowed.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (int) The number of unique values in the column
}
  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

See also

expect_column_proportion_of_unique_values_to_be_between

metric_dependencies = ['column.distinct_values.count']
success_keys = ['min_value', 'max_value']
default_kwarg_values

A Column Aggregate Metric Decorator for the Unique Value Count

validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_column_properties_table_distinct_count_row_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnValueLengthsToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to be strings with length between a minimum value and a maximum value (inclusive).

This expectation only works for string-type values. Invoking it on ints or floats will raise a TypeError.

expect_column_value_lengths_to_be_between is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments
  • min_value (int or None) – The minimum value for a column entry length.

  • max_value (int or None) – The maximum value for a column entry length.

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound, and the number of acceptable rows has no minimum.

  • If max_value is None, then min_value is treated as a lower bound, and the number of acceptable rows has no maximum.

See also

expect_column_value_lengths_to_equal

map_metric = column_values.value_length.between
success_keys = ['min_value', 'max_value', 'strict_min', 'strict_max', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration: ExpectationConfiguration = None, result: ExpectationValidationResult = None, language: str = None, runtime_configuration: dict = None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValueLengthsToEqual(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to be strings with length equal to the provided value.

This expectation only works for string-type values. Invoking it on ints or floats will raise a TypeError.

expect_column_values_to_be_between is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • value (int or None) – The expected value for a column entry length.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_value_lengths_to_be_between

map_metric = column_values.value_length.equals
success_keys = ['value', 'mostly', 'parse_strings_as_datetimes']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValueZScoresToBeLessThan(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect the Z-scores of a columns values to be less than a given threshold

expect_column_values_to_be_of_type is a column_map_expectation for typed-column backends, and also for PandasExecutionEngine where the column dtype and provided type_ are unambiguous constraints (any dtype except ‘object’ or dtype of ‘object’ with type_ specified as ‘object’).

Parameters:

column (str): The column name of a numerical column. threshold (number): A maximum Z-score threshold. All column Z-scores that are lower than this threshold will evaluate

successfully.

Keyword Args:

mostly (None or a float between 0 and 1): Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly. double_sided (boolean): A True of False value indicating whether to evaluate double sidedly.

Example: double_sided = True, threshold = 2 -> Z scores in non-inclusive interval(-2,2) double_sided = False, threshold = 2 -> Z scores in non-inclusive interval (-infinity,2)

Other Parameters:
result_format (str or None): Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY.

For more detail, see result_format.

include_config (boolean): If True, then include the Expectation config as part of the result object. For more detail, see include_config. catch_exceptions (boolean or None): If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions. meta (dict or None): A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns:

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

map_metric = column_values.z_score.under_threshold
success_keys = ['threshold', 'double_sided', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

class great_expectations.expectations.core.ExpectColumnValuesToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to be between a minimum value and a maximum value (inclusive).

expect_column_values_to_be_between is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • min_value (comparable type or None) – The minimum value for a column entry.

  • max_value (comparable type or None) – The maximum value for a column entry.

Keyword Arguments
  • strict_min (boolean) – If True, values must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, values must be strictly smaller than max_value, default=False allow_cross_type_comparisons (boolean or None) : If True, allow comparisons between types (e.g. integer and string). Otherwise, attempting such comparisons will raise an exception.

  • parse_strings_as_datetimes (boolean or None) – If True, parse min_value, max_value, and all non-null column values to datetimes before making comparisons.

  • output_strftime_format (str or None) – A valid strfime format for datetime output. Only used if parse_strings_as_datetimes=True.

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound, and there is no minimum value checked.

  • If max_value is None, then min_value is treated as a lower bound, and there is no maximum value checked.

See also

expect_column_value_lengths_to_be_between

map_metric = column_values.between
success_keys = ['min_value', 'max_value', 'strict_min', 'strict_max', 'allow_cross_type_comparisons', 'mostly', 'parse_strings_as_datetimes']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToBeDateutilParseable(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to be parsable using dateutil.

expect_column_values_to_be_dateutil_parseable is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

map_metric = column_values.dateutil_parsable
success_keys = ['mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToBeDecreasing(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column values to be decreasing.

By default, this expectation only works for numeric or datetime data. When parse_strings_as_datetimes=True, it can also parse strings to datetimes.

If strictly=True, then this expectation is only satisfied if each consecutive value is strictly decreasing–equal values are treated as failures.

expect_column_values_to_be_decreasing is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments
  • strictly (Boolean or None) – If True, values must be strictly greater than previous values

  • parse_strings_as_datetimes (boolean or None) – If True, all non-null column values to datetimes before making comparisons

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_be_increasing

map_metric = column_values.decreasing
success_keys = ['strictly', 'mostly', 'parse_strings_as_datetimes']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect each column value to be in a given set.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_values_to_be_in_set(
    "my_col",
    [2,3]
)
{
  "success": false
  "result": {
    "unexpected_count": 1
    "unexpected_percent": 16.66666666666666666,
    "unexpected_percent_nonmissing": 16.66666666666666666,
    "partial_unexpected_list": [
      1
    ],
  },
}

expect_column_values_to_be_in_set is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments
  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

  • parse_strings_as_datetimes (boolean or None) – If True values provided in value_set will be parsed as datetimes before making comparisons.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_not_be_in_set

map_metric = column_values.in_set
success_keys = ['value_set', 'mostly', 'parse_strings_as_datetimes']
default_kwarg_values
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_example_values_block_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
class great_expectations.expectations.core.ExpectColumnValuesToBeInTypeList(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect a column to contain values from a specified type list.

expect_column_values_to_be_in_type_list is a column_aggregate_expectation for typed-column backends, and also for PandasDataset where the column dtype provides an unambiguous constraints (any dtype except ‘object’). For PandasDataset columns with dtype of ‘object’ expect_column_values_to_be_of_type is a column_map_expectation and will independently check each row’s type.

Parameters
  • column (str) – The column name.

  • type_list (str) – A list of strings representing the data type that each column should have as entries. Valid types are defined by the current backend implementation and are dynamically loaded. For example, valid types for PandasDataset include any numpy dtype values (such as ‘int64’) or native python types (such as ‘int’), whereas valid types for a SqlAlchemyDataset include types named by the current driver such as ‘INTEGER’ in most SQL dialects and ‘TEXT’ in dialects such as postgresql. Valid types for SparkDFDataset include ‘StringType’, ‘BooleanType’ and other pyspark-defined type names.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

map_metric = column_values.in_type_list
success_keys = ['type_list', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate_pandas(self, actual_column_type, expected_types_list)
_validate_sqlalchemy(self, actual_column_type, expected_types_list, execution_engine)
_validate_spark(self, actual_column_type, expected_types_list)
get_validation_dependencies(self, configuration: Optional[ExpectationConfiguration] = None, execution_engine: Optional[ExecutionEngine] = None, runtime_configuration: Optional[dict] = None)

Returns the result format and metrics required to validate this Expectation using the provided result format.

_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnValuesToBeIncreasing(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column values to be increasing.

By default, this expectation only works for numeric or datetime data. When parse_strings_as_datetimes=True, it can also parse strings to datetimes.

If strictly=True, then this expectation is only satisfied if each consecutive value is strictly increasing–equal values are treated as failures.

expect_column_values_to_be_increasing is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments
  • strictly (Boolean or None) – If True, values must be strictly greater than previous values

  • parse_strings_as_datetimes (boolean or None) – If True, all non-null column values to datetimes before making comparisons

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_be_decreasing

map_metric = column_values.increasing
success_keys = ['strictly', 'mostly', 'parse_strings_as_datetimes']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToBeJsonParseable(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to be data written in JavaScript Object Notation.

expect_column_values_to_be_json_parseable is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_match_json_schema

map_metric = column_values.json_parsable
success_keys = ['mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToBeNull(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column values to be null.

expect_column_values_to_be_null is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_not_be_null

map_metric = column_values.null
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _diagnostic_observed_value_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
get_validation_dependencies(self, configuration: Optional[ExpectationConfiguration] = None, execution_engine: Optional[ExecutionEngine] = None, runtime_configuration: Optional[dict] = None)

Returns the result format and metrics required to validate this Expectation using the provided result format.

_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnValuesToBeOfType(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect a column to contain values of a specified data type.

expect_column_values_to_be_of_type is a column_aggregate_expectation for typed-column backends, and also for PandasDataset where the column dtype and provided type_ are unambiguous constraints (any dtype except ‘object’ or dtype of ‘object’ with type_ specified as ‘object’).

For PandasDataset columns with dtype of ‘object’ expect_column_values_to_be_of_type is a column_map_expectation and will independently check each row’s type.

Parameters
  • column (str) – The column name.

  • type\_ (str) – A string representing the data type that each column should have as entries. Valid types are defined by the current backend implementation and are dynamically loaded. For example, valid types for PandasDataset include any numpy dtype values (such as ‘int64’) or native python types (such as ‘int’), whereas valid types for a SqlAlchemyDataset include types named by the current driver such as ‘INTEGER’ in most SQL dialects and ‘TEXT’ in dialects such as postgresql. Valid types for SparkDFDataset include ‘StringType’, ‘BooleanType’ and other pyspark-defined type names.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

map_metric = column_values.of_type
success_keys = ['type_', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate_pandas(self, actual_column_type, expected_type)
_validate_sqlalchemy(self, actual_column_type, expected_type, execution_engine)
_validate_spark(self, actual_column_type, expected_type)
get_validation_dependencies(self, configuration: Optional[ExpectationConfiguration] = None, execution_engine: Optional[ExecutionEngine] = None, runtime_configuration: Optional[dict] = None)

Returns the result format and metrics required to validate this Expectation using the provided result format.

_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnValuesToBeUnique(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect each column value to be unique.

This expectation detects duplicates. All duplicated values are counted as exceptions.

For example, [1, 2, 3, 3, 3] will return [3, 3, 3] in result.exceptions_list, with unexpected_percent = 60.0.

expect_column_values_to_be_unique is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

map_metric = column_values.unique
success_keys = ['mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToMatchJsonSchema(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to be JSON objects matching a given JSON schema.

expect_column_values_to_match_json_schema is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_be_json_parseable

The JSON-schema docs.

map_metric = column_values.match_json_schema
success_keys = ['json_schema', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToMatchLikePattern(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

map_metric = column_values.match_like_pattern
success_keys = ['mostly', 'like_pattern']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToMatchLikePatternList(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

map_metric = column_values.match_like_pattern_list
success_keys = ['mostly', 'like_pattern_list', 'match_on']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToMatchRegex(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to be strings that match a given regular expression.

Valid matches can be found anywhere in the string, for example “[at]+” will identify the following strings as expected: “cat”, “hat”, “aa”, “a”, and “t”, and the following strings as unexpected: “fish”, “dog”.

expect_column_values_to_match_regex is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex (str) – The regular expression the column entries should match.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_not_match_regex

expect_column_values_to_match_regex_list

map_metric = column_values.match_regex
success_keys = ['regex', 'mostly']
default_kwarg_values
examples
library_metadata
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _question_renderer(cls, configuration, result=None, language=None, runtime_configuration=None)
classmethod _answer_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None)
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToMatchRegexList(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect the column entries to be strings that can be matched to either any of or all of a list of regular expressions. Matches can be anywhere in the string.

expect_column_values_to_match_regex_list is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex_list (list) – The list of regular expressions which the column entries should match

Keyword Arguments
  • match_on= (string) – “any” or “all”. Use “any” if the value should match at least one regular expression in the list. Use “all” if it should match each regular expression in the list.

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_match_regex

expect_column_values_to_not_match_regex

map_metric = column_values.match_regex_list
success_keys = ['regex_list', 'match_on', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToMatchStrftimeFormat(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to be strings representing a date or time with a given format.

expect_column_values_to_match_strftime_format is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • strftime_format (str) – A strftime format string to use for matching

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

map_metric = column_values.match_strftime_format
success_keys = ['strftime_format', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToNotBeInSet(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to not be in the set.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_values_to_not_be_in_set(
    "my_col",
    [1,2]
)
{
  "success": false
  "result": {
    "unexpected_count": 3
    "unexpected_percent": 50.0,
    "unexpected_percent_nonmissing": 50.0,
    "partial_unexpected_list": [
      1, 2, 2
    ],
  },
}

expect_column_values_to_not_be_in_set is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_be_in_set

map_metric = column_values.not_in_set
success_keys = ['value_set', 'mostly', 'parse_strings_as_datetimes']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_pandas_column_values_not_in_set(self, series: pd.Series, metrics: Dict, metric_domain_kwargs: Dict, metric_value_kwargs: Dict, runtime_configuration: dict = None, filter_column_isnull: bool = True)
class great_expectations.expectations.core.ExpectColumnValuesToNotBeNull(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column values to not be null.

To be counted as an exception, values must be explicitly null or missing, such as a NULL in PostgreSQL or an np.NaN in pandas. Empty strings don’t count as null unless they have been coerced to a null type.

expect_column_values_to_not_be_null is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_be_null

map_metric = column_values.nonnull
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _diagnostic_observed_value_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_column_properties_table_missing_count_row_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_column_properties_table_missing_percent_row_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectColumnValuesToNotMatchLikePattern(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

map_metric = column_values.not_match_like_pattern
success_keys = ['mostly', 'like_pattern']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToNotMatchLikePatternList(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

map_metric = column_values.not_match_like_pattern_list
success_keys = ['mostly', 'like_pattern_list']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToNotMatchRegex(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, “[at]+” would identify the following strings as expected: “fish”, “dog”, and the following as unexpected: “cat”, “hat”.

expect_column_values_to_not_match_regex is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex (str) – The regular expression the column entries should NOT match.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_match_regex

expect_column_values_to_match_regex_list

map_metric = column_values.not_match_regex
success_keys = ['regex', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _descriptive_column_properties_table_regex_count_row_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectColumnValuesToNotMatchRegexList(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Expect the column entries to be strings that do not match any of a list of regular expressions. Matches can be anywhere in the string.

expect_column_values_to_not_match_regex_list is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex_list (list) – The list of regular expressions which the column entries should not match

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_column_values_to_match_regex_list

map_metric = column_values.not_match_regex_list
success_keys = ['regex_list', 'mostly']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectCompoundColumnsToBeUnique(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

metric_dependencies
success_keys = ['column_list', 'ignore_row_if']
default_kwarg_values
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectMulticolumnValuesToBeUnique(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

metric_dependencies
success_keys = ['column_list', 'ignore_row_if', 'mostly']
default_kwarg_values
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectSelectColumnValuesToBeUniqueWithinRecord(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.ColumnMapExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

metric_dependencies
success_keys = ['column_list', 'ignore_row_if', 'mostly']
default_kwarg_values
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
class great_expectations.expectations.core.ExpectTableColumnCountToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Expect the number of columns to be between two values.

expect_table_column_count_to_be_between is a expectation, not a column_map_expectation or column_aggregate_expectation.

Keyword Arguments
  • min_value (int or None) – The minimum number of columns, inclusive.

  • max_value (int or None) – The maximum number of columns, inclusive.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound, and the number of acceptable columns has no minimum.

  • If max_value is None, then min_value is treated as a lower bound, and the number of acceptable columns has no maximum.

See also

expect_table_column_count_to_equal

metric_dependencies = ['table.column_count']
success_keys = ['min_value', 'max_value']
default_kwarg_values

A Metric Decorator for the Column Count

validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectTableColumnCountToEqual(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Expect the number of columns to equal a value.

expect_table_column_count_to_equal is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters

value (int) – The expected number of columns.

Other Parameters
  • result_format (string or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_table_column_count_to_be_between

metric_dependencies = ['table.column_count']
success_keys = ['value']
default_kwarg_values

A Metric Decorator for the Column Count

validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectTableColumnsToMatchOrderedList(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Expect the columns to exactly match a specified list.

expect_table_columns_to_match_ordered_list is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters

column_list (list of str) – The column names, in the correct order.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

metric_dependencies = ['table.columns']
success_keys = ['column_list']
domain_keys = ['batch_id', 'table', 'row_condition', 'condition_parser']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectTableColumnsToMatchSet(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

metric_dependencies = ['table.columns']
success_keys = ['column_set', 'exact_match']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectTableRowCountToBeBetween(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Expect the number of rows to be between two values.

expect_table_row_count_to_be_between is a expectation, not a column_map_expectation or column_aggregate_expectation.

Keyword Arguments
  • min_value (int or None) – The minimum number of rows, inclusive.

  • max_value (int or None) – The maximum number of rows, inclusive.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound, and the number of acceptable rows has no minimum.

  • If max_value is None, then min_value is treated as a lower bound, and the number of acceptable rows has no maximum.

See also

expect_table_row_count_to_equal

metric_dependencies = ['table.row_count']
success_keys = ['min_value', 'max_value']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that neccessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectTableRowCountToEqual(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Expect the number of rows to equal a value.

expect_table_row_count_to_equal is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters

value (int) – The expected number of rows.

Other Parameters
  • result_format (string or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_table_row_count_to_be_between

metric_dependencies = ['table.row_count']
success_keys = ['value']
default_kwarg_values
validate_configuration(self, configuration: Optional[ExpectationConfiguration])

Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation.

Parameters

configuration (OPTIONAL[ExpectationConfiguration]) – An optional Expectation Configuration entry that will be used to configure the expectation

Returns

True if the configuration has been validated successfully. Otherwise, raises an exception

classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)
class great_expectations.expectations.core.ExpectTableRowCountToEqualOtherTable(configuration: Optional[ExpectationConfiguration] = None)

Bases: great_expectations.expectations.expectation.TableExpectation

Base class for all Expectations.

Expectation classes must have the following attributes set:
  1. domain_keys: a tuple of the keys used to determine the domain of the expectation

  2. success_keys: a tuple of the keys used to determine the success of the expectation.

In some cases, subclasses of Expectation (such as TableExpectation) can inherit these properties from their parent class.

They may optionally override runtime_keys and default_kwarg_values, and may optionally set an explicit value for expectation_type.

  1. runtime_keys lists the keys that can be used to control output but will not affect the actual success value of the expectation (such as result_format).

  2. default_kwarg_values is a dictionary that will be used to fill unspecified kwargs from the Expectation Configuration.

Expectation classes must implement the following:
  1. _validate

  2. get_validation_dependencies

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

Additionally, they may provide implementations of:
  1. validate_configuration, which should raise an error if the configuration will not be usable for the Expectation

  2. Data Docs rendering methods decorated with the @renderer decorator. See the

metric_dependencies = ['table.row_count']
success_keys = ['other_table_name']
default_kwarg_values
classmethod _prescriptive_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
classmethod _diagnostic_observed_value_renderer(cls, configuration=None, result=None, language=None, runtime_configuration=None, **kwargs)
get_validation_dependencies(self, configuration: Optional[ExpectationConfiguration] = None, execution_engine: Optional[ExecutionEngine] = None, runtime_configuration: Optional[dict] = None)

Returns the result format and metrics required to validate this Expectation using the provided result format.

_validate(self, configuration: ExpectationConfiguration, metrics: Dict, runtime_configuration: dict = None, execution_engine: ExecutionEngine = None)