sdk

No menu items for this category
OpenMetadata Documentation

Class that allows running data quality checks by code

Classes:

  • TestRunner – Simplified test runner for executing data quality tests on OpenMetadata tables.

Simplified test runner for executing data quality tests on OpenMetadata tables.

This class provides a fluent API for defining and executing data quality tests against tables in OpenMetadata. It handles test case creation, workflow configuration, and result collection.

The runner automatically fetches table metadata and service connections from OpenMetadata, builds test cases from test definitions, and executes them using the TestSuiteWorkflow.

Attributes:

  • table_fqn (str) – Fully qualified name of the table to test
  • client (OpenMetadata) – OpenMetadata API client

Examples:

Functions:

  • add_test – Add a test definition to be executed.
  • add_tests – Add multiple test definitions at once.
  • for_table – Initialize runner for a specific table FQN.
  • from_yaml – Build TestRunner from a YAML workflow string.
  • run – Execute all added tests and return results.
  • setup – Change the default configuration for the workflow.

Parameters:

  • table_fqn (str) – Fully qualified name of the table
  • client (Optional[OpenMetadata[Any, Any]]) – Optional OpenMetadata client (will create one if not provided)

Add a test definition to be executed.

Parameters:

  • test_definition (BaseTest) – Test definition instance (e.g., TableColumnCountToBeBetween)

Returns:

  • Self for method chaining

Add multiple test definitions at once.

Parameters:

  • *test_definitions (BaseTest) – Variable number of test definition instances

Returns:

  • Self for method chaining

Examples:

Initialize runner for a specific table FQN.

Parameters:

  • table_fqn (str) – Fully qualified name of the table (e.g., "MySQL.default.db.table")
  • client (Optional[OpenMetadata[Any, Any]]) – Optional OpenMetadata client (will create one if not provided)

Returns:

  • Self – TestRunner instance

Examples:

Build TestRunner from a YAML workflow string.

Execute all added tests and return results.

Returns:

  • List[TestCaseResultResponse] – List of test case results

Change the default configuration for the workflow.

Parameters:

  • force_test_update (bool) – Force test update even if tests already exist.
  • log_level (LogLevels) – Log level to use.
  • raise_on_error (bool) – Raise exception if test data already exists.
  • success_threshold (int) – threshold below which the test will fail.
  • enable_streamable_logs (bool) – Enable streamable logs.

Returns:

  • None