Skip to content

Commit

Permalink
Adding dialect to SQL quality
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenchrist committed Oct 30, 2024
1 parent 39e859b commit 04d3c49
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -878,19 +878,20 @@ An individual SQL query that returns a single number that can be compared with a
> __Note:__ Establish a secure development process and use read-only connections, as the misuse of SQL queries can lead to SQL injection attacks.


| Field | Type | Description |
|----------------------------|-----------------------|---------------------------------------------------------------------------------|
| type | `string` | `sql` |
| description | `string` | A plain text describing the quality of the data. |
| query | `string` | A SQL query that returns a single number to compare with the threshold. |
| mustBe | `integer` | The threshold to check the return value of the query |
| mustNotBe | `integer` | The threshold to check the return value of the query |
| mustBeGreaterThan | `integer` | The threshold to check the return value of the query |
| mustBeGreaterThanOrEqualTo | `integer` | The threshold to check the return value of the query |
| mustBeLessThan | `integer` | The threshold to check the return value of the query |
| mustBeLessThanOrEqualTo | `integer` | The threshold to check the return value of the query |
| mustBeBetween | array of two integers | The threshold to check the return value of the query. Boundaries are inclusive. |
| mustNotBeBetween | array of two integers | The threshold to check the return value of the query. Boundaries are inclusive. |
| Field | Type | Description |
|----------------------------|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| type | `string` | `sql` |
| description | `string` | A plain text describing the quality of the data. |
| query | `string` | A SQL query that returns a single number to compare with the threshold. |
| dialect | `string` | The SQL dialect that is used for the query. Should be compatible to the server type. Examples: `postgres`, `spark`, `bigquery`, `snowflake`, `duckdb`, ... |
| mustBe | `integer` | The threshold to check the return value of the query |
| mustNotBe | `integer` | The threshold to check the return value of the query |
| mustBeGreaterThan | `integer` | The threshold to check the return value of the query |
| mustBeGreaterThanOrEqualTo | `integer` | The threshold to check the return value of the query |
| mustBeLessThan | `integer` | The threshold to check the return value of the query |
| mustBeLessThanOrEqualTo | `integer` | The threshold to check the return value of the query |
| mustBeBetween | array of two integers | The threshold to check the return value of the query. Boundaries are inclusive. |
| mustNotBeBetween | array of two integers | The threshold to check the return value of the query. Boundaries are inclusive. |

In the query the following placeholders can be used:

Expand Down
13 changes: 13 additions & 0 deletions datacontract.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,19 @@
"type": "string",
"description": "A SQL query that returns a single number to compare with the threshold."
},
"dialect": {
"type": "string",
"description": "The SQL dialect that is used for the query. Should be compatible to the server.type.",
"examples": [
"athena",
"bigquery",
"redshift",
"snowflake",
"trino",
"postgres",
"oracle"
]
},
"mustBe": {
"type": "integer"
},
Expand Down

0 comments on commit 04d3c49

Please sign in to comment.