total row count match percent
total row count match percent checks
Description
Table level check that ensures that there are no more than a maximum percentage of difference of row count of a tested table and of an row count of another (reference) table.
profile total row count match percent
Check description
Verifies that the total row count of the tested table matches the total row count of another (reference) table.
Check name | Check type | Time scale | Sensor definition | Quality rule |
---|---|---|---|---|
profile_total_row_count_match_percent | profiling | total_row_count_match_percent | diff_percent |
Enable check (Shell)
To enable this check provide connection name and check name in check enable command
To run this check provide check name in check run command It is also possible to run this check on a specific connection. In order to do this, add the connection name to the below It is additionally feasible to run this check on a specific table. In order to do this, add the table name to the below It is furthermore viable to combine run this check on a specific column. In order to do this, add the column name to the below
dqo> check run -c=connection_name -t=table_name -col=column_name -ch=profile_total_row_count_match_percent
profiling_checks:
accuracy:
profile_total_row_count_match_percent:
parameters:
referenced_table: dim_customer
warning:
max_diff_percent: 0.0
error:
max_diff_percent: 1.0
fatal:
max_diff_percent: 5.0
# yaml-language-server: $schema=https://cloud.dqo.ai/dqo-yaml-schema/TableYaml-schema.json
apiVersion: dqo/v1
kind: table
spec:
timestamp_columns:
event_timestamp_column: col_event_timestamp
ingestion_timestamp_column: col_inserted_at
incremental_time_window:
daily_partitioning_recent_days: 7
monthly_partitioning_recent_months: 1
profiling_checks:
accuracy:
profile_total_row_count_match_percent:
parameters:
referenced_table: dim_customer
warning:
max_diff_percent: 0.0
error:
max_diff_percent: 1.0
fatal:
max_diff_percent: 5.0
columns:
col_event_timestamp:
labels:
- optional column that stores the timestamp when the event/transaction happened
col_inserted_at:
labels:
- optional column that stores the timestamp when row was ingested
BigQuery
{% import '/dialects/bigquery.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_project_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
MySQL
{% import '/dialects/mysql.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_project_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
PostgreSQL
{% import '/dialects/postgresql.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
Redshift
{% import '/dialects/redshift.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
Snowflake
{% import '/dialects/snowflake.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
SQL Server
{% import '/dialects/sqlserver.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
daily total row count match percent
Check description
Verifies the total ow count of a tested table and compares it to a row count of a reference table. Stores the most recent captured value for each day when the data quality check was evaluated.
Check name | Check type | Time scale | Sensor definition | Quality rule |
---|---|---|---|---|
daily_total_row_count_match_percent | recurring | daily | total_row_count_match_percent | diff_percent |
Enable check (Shell)
To enable this check provide connection name and check name in check enable command
To run this check provide check name in check run command It is also possible to run this check on a specific connection. In order to do this, add the connection name to the below It is additionally feasible to run this check on a specific table. In order to do this, add the table name to the below It is furthermore viable to combine run this check on a specific column. In order to do this, add the column name to the below
dqo> check run -c=connection_name -t=table_name -col=column_name -ch=daily_total_row_count_match_percent
recurring_checks:
daily:
accuracy:
daily_total_row_count_match_percent:
parameters:
referenced_table: dim_customer
warning:
max_diff_percent: 0.0
error:
max_diff_percent: 1.0
fatal:
max_diff_percent: 5.0
# yaml-language-server: $schema=https://cloud.dqo.ai/dqo-yaml-schema/TableYaml-schema.json
apiVersion: dqo/v1
kind: table
spec:
timestamp_columns:
event_timestamp_column: col_event_timestamp
ingestion_timestamp_column: col_inserted_at
incremental_time_window:
daily_partitioning_recent_days: 7
monthly_partitioning_recent_months: 1
recurring_checks:
daily:
accuracy:
daily_total_row_count_match_percent:
parameters:
referenced_table: dim_customer
warning:
max_diff_percent: 0.0
error:
max_diff_percent: 1.0
fatal:
max_diff_percent: 5.0
columns:
col_event_timestamp:
labels:
- optional column that stores the timestamp when the event/transaction happened
col_inserted_at:
labels:
- optional column that stores the timestamp when row was ingested
BigQuery
{% import '/dialects/bigquery.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_project_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
MySQL
{% import '/dialects/mysql.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_project_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
PostgreSQL
{% import '/dialects/postgresql.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
Redshift
{% import '/dialects/redshift.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
Snowflake
{% import '/dialects/snowflake.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
SQL Server
{% import '/dialects/sqlserver.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
monthly total row count match percent
Check description
Verifies the total row count of a tested table and compares it to a row count of a reference table. Stores the most recent row count for each month when the data quality check was evaluated.
Check name | Check type | Time scale | Sensor definition | Quality rule |
---|---|---|---|---|
monthly_total_row_count_match_percent | recurring | monthly | total_row_count_match_percent | diff_percent |
Enable check (Shell)
To enable this check provide connection name and check name in check enable command
To run this check provide check name in check run command It is also possible to run this check on a specific connection. In order to do this, add the connection name to the below It is additionally feasible to run this check on a specific table. In order to do this, add the table name to the below It is furthermore viable to combine run this check on a specific column. In order to do this, add the column name to the below
dqo> check run -c=connection_name -t=table_name -col=column_name -ch=monthly_total_row_count_match_percent
recurring_checks:
monthly:
accuracy:
monthly_total_row_count_match_percent:
parameters:
referenced_table: dim_customer
warning:
max_diff_percent: 0.0
error:
max_diff_percent: 1.0
fatal:
max_diff_percent: 5.0
# yaml-language-server: $schema=https://cloud.dqo.ai/dqo-yaml-schema/TableYaml-schema.json
apiVersion: dqo/v1
kind: table
spec:
timestamp_columns:
event_timestamp_column: col_event_timestamp
ingestion_timestamp_column: col_inserted_at
incremental_time_window:
daily_partitioning_recent_days: 7
monthly_partitioning_recent_months: 1
recurring_checks:
monthly:
accuracy:
monthly_total_row_count_match_percent:
parameters:
referenced_table: dim_customer
warning:
max_diff_percent: 0.0
error:
max_diff_percent: 1.0
fatal:
max_diff_percent: 5.0
columns:
col_event_timestamp:
labels:
- optional column that stores the timestamp when the event/transaction happened
col_inserted_at:
labels:
- optional column that stores the timestamp when row was ingested
BigQuery
{% import '/dialects/bigquery.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_project_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
MySQL
{% import '/dialects/mysql.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_project_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
PostgreSQL
{% import '/dialects/postgresql.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
Redshift
{% import '/dialects/redshift.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
Snowflake
{% import '/dialects/snowflake.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}
SQL Server
{% import '/dialects/sqlserver.sql.jinja2' as lib with context -%}
{%- macro render_referenced_table(referenced_table) -%}
{%- if referenced_table.find(".") < 0 -%}
{{ lib.quote_identifier(lib.macro_database_name) }}.{{ lib.quote_identifier(lib.macro_schema_name) }}.{{- lib.quote_identifier(referenced_table) -}}
{%- else -%}
{{ referenced_table }}
{%- endif -%}
{%- endmacro -%}
SELECT
(SELECT
COUNT(*)
FROM {{ render_referenced_table(parameters.referenced_table) }} AS referenced_table
) AS expected_value,
COUNT(*) AS actual_value
FROM {{ lib.render_target_table() }} AS analyzed_table
{{- lib.render_where_clause() -}}