metadata.sdk.data_quality.tests.base_tests
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.
metadata.sdk.data_quality.tests.base_tests.BaseTest
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:
- to_test_case_definition – Create a test case definition from this test definition.
- with_compute_row_count – Enable or disable passed/failed row count computation.
- with_description – Set a custom description.
- with_display_name – Set a custom display name.
- with_name – Set a custom test case name.
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)
metadata.sdk.data_quality.tests.base_tests.BaseTest.compute_passed_failed_row_count
metadata.sdk.data_quality.tests.base_tests.BaseTest.description
metadata.sdk.data_quality.tests.base_tests.BaseTest.display_name
metadata.sdk.data_quality.tests.base_tests.BaseTest.name
metadata.sdk.data_quality.tests.base_tests.BaseTest.parameters
metadata.sdk.data_quality.tests.base_tests.BaseTest.test_definition_name
metadata.sdk.data_quality.tests.base_tests.BaseTest.to_test_case_definition
Create a test case definition from this test definition. Returns: TestCaseDefinition instance
metadata.sdk.data_quality.tests.base_tests.BaseTest.with_compute_row_count
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
metadata.sdk.data_quality.tests.base_tests.BaseTest.with_description
Set a custom description.
Parameters:
- description (
str) – Detailed description of what this test validates
Returns:
Self– Self for method chaining
metadata.sdk.data_quality.tests.base_tests.BaseTest.with_display_name
Set a custom display name.
Parameters:
- display_name (
str) – Human-readable name for UI display
Returns:
Self– Self for method chaining
metadata.sdk.data_quality.tests.base_tests.BaseTest.with_name
Set a custom test case name.
Parameters:
- name (
str) – Unique identifier for this test case
Returns:
Self– Self for method chaining
metadata.sdk.data_quality.tests.base_tests.ColumnTest
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:
- to_test_case_definition – Create a test case definition from this test definition.
- with_compute_row_count – Enable or disable passed/failed row count computation.
- with_description – Set a custom description.
- with_display_name – Set a custom display name.
- with_name – Set a custom test case name.
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)
metadata.sdk.data_quality.tests.base_tests.ColumnTest.column_name
metadata.sdk.data_quality.tests.base_tests.ColumnTest.compute_passed_failed_row_count
metadata.sdk.data_quality.tests.base_tests.ColumnTest.description
metadata.sdk.data_quality.tests.base_tests.ColumnTest.display_name
metadata.sdk.data_quality.tests.base_tests.ColumnTest.name
metadata.sdk.data_quality.tests.base_tests.ColumnTest.parameters
metadata.sdk.data_quality.tests.base_tests.ColumnTest.test_definition_name
metadata.sdk.data_quality.tests.base_tests.ColumnTest.to_test_case_definition
Create a test case definition from this test definition. Returns: TestCaseDefinition instance
metadata.sdk.data_quality.tests.base_tests.ColumnTest.with_compute_row_count
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
metadata.sdk.data_quality.tests.base_tests.ColumnTest.with_description
Set a custom description.
Parameters:
- description (
str) – Detailed description of what this test validates
Returns:
Self– Self for method chaining
metadata.sdk.data_quality.tests.base_tests.ColumnTest.with_display_name
Set a custom display name.
Parameters:
- display_name (
str) – Human-readable name for UI display
Returns:
Self– Self for method chaining
metadata.sdk.data_quality.tests.base_tests.ColumnTest.with_name
Set a custom test case name.
Parameters:
- name (
str) – Unique identifier for this test case
Returns:
Self– Self for method chaining
metadata.sdk.data_quality.tests.base_tests.TableTest
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:
- to_test_case_definition – Create a test case definition from this test definition.
- with_compute_row_count – Enable or disable passed/failed row count computation.
- with_description – Set a custom description.
- with_display_name – Set a custom display name.
- with_name – Set a custom test case name.
Attributes:
- compute_passed_failed_row_count (
bool) – - description (
Optional[str]) – - display_name (
Optional[str]) – - name (
Optional[str]) – - parameters (
List[TestCaseParameterValue]) – - test_definition_name (
str) –