IF Commons GitHub

sql/quality/generic

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0052-sql-quality FR-005

The generic tests of SQL-DQ (commons data 0052-sql-quality): the four that dbt has built in (not_null, unique, accepted_values, relationships) and those of the packages that are used most (expression_is_true, unique_combination_of_columns, not_empty_string, accepted_range, at_least_one, not_constant, equal_rowcount, equality). Each is SQL that gives the rows that are wrong, written with the quoting and the literals of the dialect.

Source: commons/data/sql/quality/generic.ts

11 of 11 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

acceptedRangeconst
const acceptedRange: GenericTest<{ readonly min?: number | undefined; readonly max?: number | undefined; readonly inclusive?: boolean | undefined; }, "column">

Every value of the column is in a range; inclusive is true where it is not said.

Imported by 15 tests of the run (15 passed, 0 failed): the library's results

acceptedValuesconst
const acceptedValues: GenericTest<{ readonly values: readonly (string | number | boolean)[]; }, "column">

The column holds only the values that are listed; a null is not looked at, as in dbt (it is for notNull).

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

atLeastOneconst
const atLeastOne: GenericTest<void, "column">

The column has at least one value that is not null.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

equalRowcountconst
const equalRowcount: GenericTest<{ readonly to: Relation; }, "model">

The model has as many rows as another relation.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

equalityconst
const equality: GenericTest<{ readonly to: Relation; readonly columns: readonly [string, ...string[]]; }, "model">

The model has the same rows as another relation, in the columns that are named (the rows that are in one and not in the other are the failing rows).

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

expressionIsTrueconst
const expressionIsTrue: GenericTest<{ readonly expression: string; }, "model">

The expression, written in the dialect, is true of every row (of the column's table, if on a column).

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

notConstantconst
const notConstant: GenericTest<void, "column">

The column does not hold one value in all its rows.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

notEmptyStringconst
const notEmptyString: GenericTest<void | { readonly trim?: boolean | undefined; }, "column">

No value of the column is empty or only white space; a null is for notNull.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

notNullconst
const notNull: GenericTest<void, "column">

Every row has a value in the column.

Imported by 15 tests of the run (15 passed, 0 failed): the library's results

relationshipsconst
const relationships: GenericTest<{ readonly to: Relation; readonly field: string; readonly toWhere?: string | undefined; }, "column">

Every value of the column that is not null is the value of a column of another relation. where filters the relation tested; toWhere the other.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

uniqueCombinationOfColumnsconst
const uniqueCombinationOfColumns: GenericTest<{ readonly columns: readonly [string, ...string[]]; }, "model">

No combination of the columns is in more than one row.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.