great_expectations.dataset.sqlalchemy_dataset

Module Contents

Classes

SqlAlchemyBatchReference(engine, table_name=None, schema=None, query=None)

MetaSqlAlchemyDataset(*args, **kwargs)

Holds expectation decorators.

SqlAlchemyDataset(table_name=None, engine=None, connection_string=None, custom_sql=None, schema=None, *args, **kwargs)

great_expectations.dataset.sqlalchemy_dataset.logger
great_expectations.dataset.sqlalchemy_dataset.sa
great_expectations.dataset.sqlalchemy_dataset.sqlalchemy_psycopg2
great_expectations.dataset.sqlalchemy_dataset.sqlalchemy_redshift
great_expectations.dataset.sqlalchemy_dataset.snowflake
great_expectations.dataset.sqlalchemy_dataset.bigquery_types_tuple
great_expectations.dataset.sqlalchemy_dataset.INT
class great_expectations.dataset.sqlalchemy_dataset.SqlAlchemyBatchReference(engine, table_name=None, schema=None, query=None)

Bases: object

get_init_kwargs(self)
class great_expectations.dataset.sqlalchemy_dataset.MetaSqlAlchemyDataset(*args, **kwargs)

Bases: great_expectations.dataset.dataset.Dataset

Holds expectation decorators.

classmethod column_map_expectation(cls, func)

For SqlAlchemy, this decorator allows individual column_map_expectations to simply return the filter that describes the expected condition on their data.

The decorator will then use that filter to obtain unexpected elements, relevant counts, and return the formatted object.

_get_count_query_mssql(self, expected_condition: BinaryExpression, ignore_values_condition: BinaryExpression)
_get_count_query_generic_sqlalchemy(self, expected_condition: BinaryExpression, ignore_values_condition: BinaryExpression)
class great_expectations.dataset.sqlalchemy_dataset.SqlAlchemyDataset(table_name=None, engine=None, connection_string=None, custom_sql=None, schema=None, *args, **kwargs)

Bases: great_expectations.dataset.sqlalchemy_dataset.MetaSqlAlchemyDataset

Feature Maturity

icon-23f321c6dd7311eab25a0242ac110002 Validation Engine - SQLAlchemy - How-to Guide
Use SQLAlchemy to validate data in a database
Maturity: Production
Details:
API Stability: High
Implementation Completeness: Moderate (temp table handling/permissions not universal)
Unit Test Coverage: High
Integration Infrastructure/Test Coverage: N/A
Documentation Completeness: Minimal (none)
Bug Risk: Low
classmethod from_dataset(cls, dataset=None)

This base implementation naively passes arguments on to the real constructor, which is suitable really when a constructor knows to take its own type. In general, this should be overridden

property sql_engine_dialect(self)
attempt_allowing_relative_error(self)

Subclasses can override this method if the respective data source (e.g., Redshift) supports “approximate” mode. In certain cases (e.g., for SparkDFDataset), a fraction between 0 and 1 (i.e., not only a boolean) is allowed.

head(self, n=5)

Returns a PandasDataset with the first n rows of the given Dataset

get_row_count(self, table_name=None)

Returns: int, table row count

get_column_count(self)

Returns: int, table column count

get_table_columns(self)

Returns: List[str], list of column names

get_column_nonnull_count(self, column)

Returns: int

get_column_sum(self, column)

Returns: float

get_column_max(self, column, parse_strings_as_datetimes=False)

Returns: any

get_column_min(self, column, parse_strings_as_datetimes=False)

Returns: any

get_column_value_counts(self, column, sort='value', collate=None)

Get a series containing the frequency counts of unique values from the named column.

Parameters
  • column – the column for which to obtain value_counts

  • sort (string) – must be one of “value”, “count”, or “none”. - if “value” then values in the resulting partition object will be sorted lexigraphically - if “count” then values will be sorted according to descending count (frequency) - if “none” then values will not be sorted

  • collate (string) – the collate (sort) method to be used on supported backends (SqlAlchemy only)

Returns

pd.Series of value counts for a column, sorted according to the value requested in sort

get_column_mean(self, column)

Returns: float

get_column_unique_count(self, column)

Returns: int

get_column_median(self, column)

Returns: any

get_column_quantiles(self, column: str, quantiles: Iterable, allow_relative_error: bool = False)

Get the values in column closest to the requested quantiles :param column: name of column :type column: string :param quantiles: the quantiles to return. quantiles must be a tuple to ensure caching is possible :type quantiles: tuple of float

Returns

the nearest values in the dataset to those quantiles

Return type

List[any]

_get_column_quantiles_mssql(self, column: str, quantiles: Iterable)
_get_column_quantiles_bigquery(self, column: str, quantiles: Iterable)
_get_column_quantiles_mysql(self, column: str, quantiles: Iterable)
_get_column_quantiles_generic_sqlalchemy(self, column: str, quantiles: Iterable, allow_relative_error: bool)
get_column_stdev(self, column)

Returns: float

get_column_hist(self, column, bins)

return a list of counts corresponding to bins

Parameters
  • column – the name of the column for which to get the histogram

  • bins – tuple of bin edges for which to get histogram values; must be tuple to support caching

get_column_count_in_range(self, column, min_val=None, max_val=None, strict_min=False, strict_max=True)

Returns: int

create_temporary_table(self, table_name, custom_sql, schema_name=None)

Create Temporary table based on sql query. This will be used as a basis for executing expectations. WARNING: this feature is new in v0.4. It hasn’t been tested in all SQL dialects, and may change based on community feedback. :param custom_sql:

column_reflection_fallback(self)

If we can’t reflect the table, use a query to at least get column names.

expect_table_row_count_to_equal_other_table(self, other_table_name, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the number of rows in this table to equal the number of rows in a different table.

expect_table_row_count_to_equal is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters

other_table_name (str) – The name of the other table to which to compare.

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

expect_column_values_to_be_null(self, column, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_values_to_not_be_null(self, column, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

_get_dialect_type_module(self)
expect_column_values_to_be_of_type(self, column, type_, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_values_to_be_in_type_list(self, column, type_list, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_values_to_be_in_set(self, column, value_set, mostly=None, parse_strings_as_datetimes=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_values_to_not_be_in_set(self, column, value_set, mostly=None, parse_strings_as_datetimes=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_values_to_be_between(self, column, min_value=None, max_value=None, strict_min=False, strict_max=False, allow_cross_type_comparisons=None, parse_strings_as_datetimes=None, output_strftime_format=None, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_value_lengths_to_equal(self, column, value, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_value_lengths_to_be_between(self, column, min_value=None, max_value=None, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_values_to_be_unique(self, column, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

_get_dialect_regex_expression(self, column, regex, positive=True)
expect_column_values_to_match_regex(self, column, regex, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_values_to_not_match_regex(self, column, regex, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=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”.

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.

expect_column_values_to_match_regex_list(self, column, regex_list, match_on='any', mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

expect_column_values_to_not_match_regex_list(self, column, regex_list, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

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.

_get_dialect_like_pattern_expression(self, column, like_pattern, positive=True)
expect_column_values_to_match_like_pattern(self, column, like_pattern, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)
expect_column_values_to_not_match_like_pattern(self, column, like_pattern, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)
expect_column_values_to_match_like_pattern_list(self, column, like_pattern_list, match_on='any', mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)
expect_column_values_to_not_match_like_pattern_list(self, column, like_pattern_list, mostly=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)