Create a custom SQL rule using SQL AI
You can use SQL AI to suggest custom SQL queries based on your plain-text input.
Prerequisites
- You have an existing Data Quality Job with at least one run.
- The Data Quality Pushdown Processing Edge capability is enabled for your data source.
- You have the Data Quality Editor or Data Quality Manager resource role with the following resource permissions, depending on the actions you intend to perform:
Action | Role and permission requirement |
---|---|
Create a custom rule monitor | You have the Data Quality Editor or Data Quality Manager resource role with the Data Quality Job > Create Monitor resource permission. |
Edit, suppress, or activate a monitor | You have the Data Quality Editor or Data Quality Manager resource role with the Data Quality Job > Edit Monitor resource permission. |
Delete a rule monitor | You have the Data Quality Editor or Data Quality Manager resource role with the Data Quality Job > Delete Monitor resource permission. |
To preview rule break records | You have the Data Quality Editor or Data Quality Manager resource role with the Data Quality Job > Preview Rule Break Records resource permission. |
Steps
- Select the job to which you want to add a rule from the Job drop-down list, or enter its name in the input field.
- Enter a unique name in the Rule name input field.
- Optionally, select a primary column from the Primary column drop-down list. This allows Collibra to associate your rule with a column asset based on the selected primary column.
- In the upper-right corner of the SQL editor, click
SQL AI to allow Collibra to suggest a SQL query based on your plain-text input.
The SQL AI chat box appears in the right side of the SQL editor. - In the chat box input field, enter a plaint-text prompt.
- "high is more than 50"
- "find all of the unique values in Column1 and show how many records exist for each"
- "compare the 2 dates 2018-01-13 to 2018-01-14 - write 2 separate queries for each date, using trade date - write as a common table expression for tables a and b - join using symbol column - use a join to identify which values are in 2018-01-14 that are not in 2018-01-13 - the goal is to find values that are missing from the previous day"
- Click
.
A suggested SQL query is returned. - Click
to copy the suggested SQL to your clipboard,
to copy the suggested SQL directly to the SQL editor, or enter a new prompt.
- Optionally, click
Format to automatically format the SQL for improved readability.
- Optionally, click Validate SQL to validate the syntax of your query.
- Optionally, click the Settings tab.
The settings tab opens, where you can associate data quality dimensions with your rule, set a rule tolerance percentage, and add notifications and a description. - Click Save.
The rule is added to your job.
Note You cannot use a name that is already in use by another rule in the job. Rule names can contain periods (.), underscores (_), and hyphens (-). All other special characters are not allowed.
Example
- About rule-level settings
- Go to the Job Details page to:
- Manually re-run your job and view the output of the rule monitor in the Monitors tab.
- View the output of the rule monitor in the Monitors tab after your scheduled job runs automatically.