great_expectations.expectations.metrics.util

Module Contents

Functions

get_dialect_regex_expression(column, regex, dialect, positive=True)

_get_dialect_type_module(dialect=None)

attempt_allowing_relative_error(dialect)

is_column_present_in_table(engine: Engine, table_selectable: Select, column_name: str, schema_name: Optional[str] = None)

get_sqlalchemy_column_metadata(engine: Engine, table_selectable: Select, schema_name: Optional[str] = None)

column_reflection_fallback(selectable: Select, dialect: Dialect, sqlalchemy_engine: Engine)

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

parse_value_set(value_set)

filter_pair_metric_nulls(column_A, column_B, ignore_row_if)

get_dialect_like_pattern_expression(column, dialect, like_pattern, positive=True)

validate_distribution_parameters(distribution, params)

Ensures that necessary parameters for a distribution are present and that all parameters are sensical.

_scipy_distribution_positional_args_from_dict(distribution, params)

Helper function that returns positional arguments for a scipy distribution using a dict of parameters.

is_valid_continuous_partition_object(partition_object)

Tests whether a given object is a valid continuous partition object. See Partition Objects.

great_expectations.expectations.metrics.util.sqlalchemy_psycopg2
great_expectations.expectations.metrics.util.snowflake
great_expectations.expectations.metrics.util.sa
great_expectations.expectations.metrics.util.sqlalchemy_redshift
great_expectations.expectations.metrics.util.logger
great_expectations.expectations.metrics.util.bigquery_types_tuple
great_expectations.expectations.metrics.util.get_dialect_regex_expression(column, regex, dialect, positive=True)
great_expectations.expectations.metrics.util._get_dialect_type_module(dialect=None)
great_expectations.expectations.metrics.util.attempt_allowing_relative_error(dialect)
great_expectations.expectations.metrics.util.is_column_present_in_table(engine: Engine, table_selectable: Select, column_name: str, schema_name: Optional[str] = None) → bool
great_expectations.expectations.metrics.util.get_sqlalchemy_column_metadata(engine: Engine, table_selectable: Select, schema_name: Optional[str] = None) → Optional[List[Dict[str, Any]]]
great_expectations.expectations.metrics.util.column_reflection_fallback(selectable: Select, dialect: Dialect, sqlalchemy_engine: Engine) → List[Dict[str, str]]

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

great_expectations.expectations.metrics.util.parse_value_set(value_set)
great_expectations.expectations.metrics.util.filter_pair_metric_nulls(column_A, column_B, ignore_row_if)
great_expectations.expectations.metrics.util.get_dialect_like_pattern_expression(column, dialect, like_pattern, positive=True)
great_expectations.expectations.metrics.util.validate_distribution_parameters(distribution, params)

Ensures that necessary parameters for a distribution are present and that all parameters are sensical.

If parameters necessary to construct a distribution are missing or invalid, this function raises ValueError with an informative description. Note that ‘loc’ and ‘scale’ are optional arguments, and that ‘scale’ must be positive.

Parameters
  • distribution (string) – The scipy distribution name, e.g. normal distribution is ‘norm’.

  • params (dict or list) –

    The distribution shape parameters in a named dictionary or positional list form following the scipy cdf argument scheme.

    params={‘mean’: 40, ‘std_dev’: 5} or params=[40, 5]

Exceptions:

ValueError: With an informative description, usually when necessary parameters are omitted or are invalid.

great_expectations.expectations.metrics.util._scipy_distribution_positional_args_from_dict(distribution, params)

Helper function that returns positional arguments for a scipy distribution using a dict of parameters.

See the cdf() function here https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.beta.html#Methods to see an example of scipy’s positional arguments. This function returns the arguments specified by the scipy.stat.distribution.cdf() for tha distribution.

Parameters
  • distribution (string) – The scipy distribution name.

  • params (dict) – A dict of named parameters.

Raises

AttributeError – If an unsupported distribution is provided.

great_expectations.expectations.metrics.util.is_valid_continuous_partition_object(partition_object)

Tests whether a given object is a valid continuous partition object. See Partition Objects.

Parameters

partition_object – The partition_object to evaluate

Returns

Boolean