Data Observability platform Help

Rules

Rules allow to set SQL generation rules, which can be used for Test generation (see chapter Test generation). Users can define their custom SQL generation rules based on their needs. Some default rules are defined on initial setup. Dynamic rules are managed from the Test cases page via More → Dynamic rules.

testCaseRules.png

  • Editing a rule – edit existing rule for test generation (click on rule to edit)

  • Add a new rule – add a new dynamic rule for automatic test generation (click on the "New rule" button)

  • Parameters – used in rule generation, grouped into Default and Custom; reference them in a rule's SQL as <name> (see chapter Parameters)

Parameters

Parameters are part of rules that are replaced by database metadata or user input to dynamically generate test cases. Default parameters are replaced by database metadata:

  • <db_name> - replaced with database name

  • <schema> - replaced with database schema name

  • <object> - replaced with table or view name

  • <column> - replaced with a single selected column name

  • <columns> - replaced with all (or selected) column names separated by commas. Column names are wrapped based on database syntax:

    • postgres, oracle, sap iq – “column”

    • MS SQL server – [column]

    • MySQL, MariaDB – `column`

  • <pk_columns> - replaced by primary key columns (comma separated). If primary keys are not found then the test is not generated

  • <forEachColumn></forEachColumn> - content between these two parameters are repeated for all (or selected) columns.

  • It is also possible to use parameters <column_name> and <column_data_type> in the content.

Custom parameters

  1. Insert new parameter name into the "New parameter" field and confirm

    customParameters.png

  2. New parameter will be displayed in the Custom group of the parameter list

  3. This parameter can be used in rule creation and test generation

  4. Parameters can be deleted from the list with the remove button (a confirmation is shown)

Adding/editing a rule

  1. Click on the "New rule" button (or an existing rule to edit it)

  2. Fill in rule properties

    editRule.png

    • Test case name – description which is added to all tests generated by this rule. <parameter> will be replaced with custom parameters or metadata from the database. For example: “myschema.mytable – Full duplicates”

    • Description – explanation for the rule

    • SQL template – SQL syntax with <parameter>. The editor lists the available parameters beside it, and clicking one inserts it

    • Expected result – expected numeric or string value from the query (can be empty).

      • greater than – >0

      • lesser than – <1000000

      • equal – =10

      • previous – >previous

      • conjunctions (&&, ||):

        • AND – >0&&>previous

        • OR >0||=previous

    • Drivers – JDBC drivers which this rule applies to

  3. Press the "Save" button

Example rules

These are some dynamic rules that use database metadata as parameters.

  • Test name:<schema>.<object> - Count of rows

  • Rule description: Check if object has any rows inserted

  • Expected result: >0

  • SQL:

SELECT COUNT(*) FROM <schema>.<object>
  • Test name:<schema>.<object> - Duplicates

  • Rule description: Check if object has any duplicate rows

  • Expected result: =0

  • SQL:

SELECT COUNT(*) FROM (SELECT <columns> FROM <schema>.<object> GROUP BY <columns> HAVING COUNT(*)>1) a
  • Test name:<schema>.<object> - NULL columns

  • Rule description: Check if object has any columns that are NULL in all rows

  • Expected result: empty string – leave empty

  • SQL:

SELECT '' <forEachColumn> || CASE WHEN COUNT(<column_name>) = 0 THEN '<column_name>;' ELSE '' END </forEachColumn> FROM <schema>.<object>

Deleting existing rules

  1. Find the rule you want to delete and click on it

  2. Click the "Delete" button

14 August 2026