sdk

No menu items for this category
OpenMetadata Documentation

Test definition wrappers for simplified DQ as Code API.

Classes:

  • BaseTest – Base class for all data quality test definitions.
  • ColumnTest – Base class for column-level data quality test definitions.
  • TableTest – Base class for table-level data quality test definitions.

Base class for all data quality test definitions.

This class provides a fluent API for configuring test cases with metadata and parameters. All test definitions inherit from this base class.

Attributes:

  • test_definition_name (str) – Internal name of the test definition type
  • parameters (List[TestCaseParameterValue]) – List of test case parameter values
  • name (Optional[str]) – Unique identifier for this test case instance
  • display_name (Optional[str]) – Human-readable name shown in UI
  • description (Optional[str]) – Detailed description of what the test validates
  • compute_passed_failed_row_count (bool) – Whether to compute row-level pass/fail counts

Functions:

Parameters:

  • test_definition_name (str) – Internal name matching the test definition in OpenMetadata
  • name (Optional[str]) – Unique identifier for this test case (auto-generated if not provided)
  • display_name (Optional[str]) – Human-readable name for UI display (auto-generated if not provided)
  • description (Optional[str]) – Description of what this test validates (auto-generated if not provided)

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: BaseTest Base class for column-level data quality test definitions.

Column tests validate properties of specific columns, such as uniqueness, null values, value ranges, or pattern matching.

All column-level test definitions should inherit from this class.

Attributes:

  • column_name (str) – Name of the column this test validates

Functions:

Parameters:

  • test_definition_name (str) – Internal name matching the test definition in OpenMetadata
  • column (str) – Name of the column to test
  • name (Optional[str]) – Unique identifier for this test case (auto-generated if not provided)
  • display_name (Optional[str]) – Human-readable name for UI display (auto-generated if not provided)
  • description (Optional[str]) – Description of what this test validates (auto-generated if not provided)

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: BaseTest Base class for table-level data quality test definitions.

Table tests validate properties of entire tables, such as row counts, column counts, or custom SQL queries against the table.

All table-level test definitions should inherit from this class.

Functions:

Attributes: