sdk

No menu items for this category
OpenMetadata Documentation

Column-level test definitions for DQ as Code API.

Classes:

Bases: ColumnTest

Validates that the length of string values in a column falls within a specified range.

This test checks character count for text columns, useful for validating string constraints, preventing truncation, and ensuring data format compliance.

Parameters:

  • column (str) – Name of the column to validate
  • min_length (Optional[int]) – Minimum acceptable string length
  • max_length (Optional[int]) – Maximum acceptable string length
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that the maximum value in a column falls within a specified range.

This test computes the maximum value across all rows and checks if it's within bounds. Useful for monitoring data ranges and detecting outliers in the upper range.

Parameters:

  • column (str) – Name of the column to validate
  • min_value (Optional[float]) – Minimum acceptable maximum value
  • max_value (Optional[float]) – Maximum acceptable maximum value
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that the mean (average) value in a column falls within a specified range.

This test computes the arithmetic mean of all values and checks if it's within bounds. Useful for statistical validation and detecting data drift in numeric columns.

Parameters:

  • column (str) – Name of the column to validate
  • min_value (Optional[float]) – Minimum acceptable mean value
  • max_value (Optional[float]) – Maximum acceptable mean value
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that the median value in a column falls within a specified range.

This test computes the median (middle value) and checks if it's within bounds. More robust than mean for skewed distributions, useful for detecting outliers.

Parameters:

  • column (str) – Name of the column to validate
  • min_value (Optional[float]) – Minimum acceptable median value
  • max_value (Optional[float]) – Maximum acceptable median value
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that the minimum value in a column falls within a specified range.

This test computes the minimum value across all rows and checks if it's within bounds. Useful for monitoring data ranges and detecting outliers in the lower range.

Parameters:

  • column (str) – Name of the column to validate
  • min_value (Optional[float]) – Minimum acceptable minimum value
  • max_value (Optional[float]) – Maximum acceptable minimum value
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that the standard deviation of column values falls within a specified range.

This test computes the standard deviation (measure of variance) and checks if it's within bounds. Useful for detecting unexpected data variability or consistency issues.

Parameters:

  • column (str) – Name of the column to validate
  • min_value (Optional[float]) – Minimum acceptable standard deviation
  • max_value (Optional[float]) – Maximum acceptable standard deviation
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that the count of missing or null values meets expectations.

This test counts rows with missing values and validates against expected thresholds. Supports custom missing value patterns beyond NULL (e.g., "N/A", "", "NULL").

Parameters:

  • column (str) – Name of the column to validate
  • missing_count_value (Optional[int]) – Expected number of missing values
  • missing_value_match (Optional[str]) – List of strings to treat as missing values (optional)
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that the sum of all values in a column falls within a specified range.

This test computes the total sum across all rows and checks if it's within bounds. Useful for validating totals, aggregates, and detecting unexpected data volumes.

Parameters:

  • column (str) – Name of the column to validate
  • min_value (Optional[float]) – Minimum acceptable sum
  • max_value (Optional[float]) – Maximum acceptable sum
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that a specific value appears at an expected row position.

This test checks for an exact value at a particular row index, useful for validating sorted data, header rows, or expected entries at known positions.

Parameters:

  • column (str) – Name of the column to validate
  • expected_value (str) – The exact value expected at the specified location
  • row_index (int) – Zero-based row position to check (default: 0)
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that all values in a column fall within a specified numeric range.

This test checks that individual column values are between minimum and maximum bounds. Useful for validating numeric constraints, age ranges, prices, quantities, etc.

Parameters:

  • column (str) – Name of the column to validate
  • min_value (Optional[float]) – Minimum acceptable value (inclusive)
  • max_value (Optional[float]) – Maximum acceptable value (inclusive)
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that all values in a column belong to a specified set of allowed values.

This test ensures data integrity by checking that column values are constrained to a predefined list. Useful for enum-like columns or categorical data.

Parameters:

  • column (str) – Name of the column to validate
  • allowed_values (List[str]) – List of acceptable values for the column
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that column values do not contain any forbidden values.

This test detects the presence of blacklisted or invalid values in a column. Useful for data quality checks where certain values should never appear.

Parameters:

  • column (str) – Name of the column to validate
  • forbidden_values (List[str]) – List of values that must not appear in the column
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that a column contains no null or missing values.

This test ensures data completeness by checking for NULL values in a column. One of the most common data quality tests for required fields.

Parameters:

  • column (str) – Name of the column to validate
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that all values in a column are unique with no duplicates.

This test checks for duplicate values in columns that should contain unique identifiers or keys. Essential for primary key and unique constraint validation.

Parameters:

  • column (str) – Name of the column to validate
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that column values match a specified regular expression pattern.

This test ensures data format consistency by checking that values conform to expected patterns. Useful for emails, phone numbers, IDs, and formatted strings.

Parameters:

  • column (str) – Name of the column to validate
  • regex (str) – Regular expression pattern that values must match
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining

Bases: ColumnTest

Validates that column values do not match a forbidden regular expression pattern.

This test detects values that match unwanted patterns, useful for identifying invalid formats, test data, or security risks.

Parameters:

  • column (str) – Name of the column to validate
  • regex (str) – Regular expression pattern that values must NOT match
  • name (Optional[str]) – Custom test case name
  • display_name (Optional[str]) – Custom display name for UI
  • description (Optional[str]) – Custom test description

Examples:

Functions:

Attributes:

Create a test case definition from this test definition. Returns: TestCaseDefinition instance

Enable or disable passed/failed row count computation.

When enabled, the test will compute and report the number and percentage of rows that passed or failed the test validation.

Parameters:

  • compute (bool) – Whether to compute row-level pass/fail statistics

Returns:

  • Self – Self for method chaining

Set a custom description.

Parameters:

  • description (str) – Detailed description of what this test validates

Returns:

  • Self – Self for method chaining

Set a custom display name.

Parameters:

  • display_name (str) – Human-readable name for UI display

Returns:

  • Self – Self for method chaining

Set a custom test case name.

Parameters:

  • name (str) – Unique identifier for this test case

Returns:

  • Self – Self for method chaining